anchor.diff:  -module(vmq_connect_SUITE).
  --export([
  -         %% suite/0,
  -         init_per_suite/1,
  -         end_per_suite/1,
  -         init_per_testcase/2,
  -         end_per_testcase/2,
  -         all/0
  -        ]).
   
  --export([anon_denied_test/1,
  -         anon_success_test/1,
  -         invalid_id_0_test/1,
  -         invalid_id_0_311_test/1,
  -         invalid_id_missing_test/1,
  -         invalid_id_24_test/1,
  -         invalid_protonum_test/1,
  -         uname_no_password_denied_test/1,
  -         uname_password_denied_test/1,
  -         uname_password_success_test/1,
  -         change_subscriber_id_test/1]).
  -
  --export([hook_empty_client_id_proto_4/5,
  -         hook_uname_no_password_denied/5,
  -         hook_uname_password_denied/5,
  -         hook_uname_password_success/5,
  -         hook_change_subscriber_id/5,
  -         hook_on_register_changed_subscriber_id/3]).
  +-compile(export_all).
  +-compile(nowarn_export_all).
   
   %% ===================================================================
   %% common_test callbacks
   %% ===================================================================
   init_per_suite(_Config) ->
       cover:start(),
  +    vmq_test_utils:setup(),
       _Config.
   
   end_per_suite(_Config) ->
  +    vmq_test_utils:teardown(),
       _Config.
   
  +init_per_group(mqtt, Config) ->
  +    Port = 1888,
  +    Address = "127.0.0.1",
  +    Opts = [],
  +    vmq_server_cmd:listener_start(Port, Address, Opts),
  +    [{address, Address},{port, Port},{opts, Opts}|Config].
  +
  +end_per_group(mqtt, Config) ->
  +    Port = proplists:get_value(port, Config),
  +    Address = proplists:get_value(address, Config),
  +    vmq_server_cmd:listener_stop(Port, Address, false),
  +    ok.
  +
   init_per_testcase(_Case, Config) ->
  -    vmq_test_utils:setup(),
  +    %% reset config before each test
       vmq_server_cmd:set_config(allow_anonymous, false),
       vmq_server_cmd:set_config(max_client_id_size, 23),
  -    vmq_server_cmd:listener_start(1888, []),
  +    vmq_config:configure_node(),
       Config.
   
   end_per_testcase(_, Config) ->
  -    vmq_test_utils:teardown(),
       Config.
   
   all() ->
  -    [anon_denied_test,
  -     anon_success_test,
  -     invalid_id_0_test,
  -     invalid_id_0_311_test,
  -     invalid_id_missing_test,
  -     invalid_id_24_test,
  -     invalid_protonum_test,
  -     uname_no_password_denied_test,
  -     uname_password_denied_test,
  -     uname_password_success_test,
  -     change_subscriber_id_test].
  +    [
  +     {group, mqtt}
  +    ].
  +
  +groups() ->
  +    Tests = 
  +        [anon_denied_test,
  +         anon_success_test,
  +         invalid_id_0_test,
  +         invalid_id_0_311_test,
  +         invalid_id_missing_test,
  +         invalid_id_24_test,
  +         invalid_protonum_test,
  +         uname_no_password_denied_test,
  +         uname_password_denied_test,
  +         uname_password_success_test,
  +         change_subscriber_id_test
  +        ],
  +    [
  +     {mqtt, [], Tests}
  +    ].
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%% Actual Tests
  
positive.code: invalid_id_0_311_test(_) ->
      Connect = packet:gen_connect(empty, [{keepalive,10},{proto_ver,4}]),
      Connack = packet:gen_connack(0),
      vmq_plugin_mgr:enable_module_plugin(
        auth_on_register, ?MODULE, hook_empty_client_id_proto_4, 5),
      {ok, Socket} = packet:do_client_connect(Connect, Connack, []),
      vmq_plugin_mgr:disable_module_plugin(
        auth_on_register, ?MODULE, hook_empty_client_id_proto_4, 5),
      ok = gen_tcp:close(Socket).
  
  
negative.code:                                  [{keepalive,10}, {username, "whatever"},
                                    {password, "whatever"}]),
      Connack = packet:gen_connack(0),
      ok = vmq_plugin_mgr:enable_module_plugin(
        auth_on_register, ?MODULE, hook_change_subscriber_id, 5),
      ok = vmq_plugin_mgr:enable_module_plugin(
        on_register, ?MODULE, hook_on_register_changed_subscriber_id, 3),
      {ok, Socket} = packet:do_client_connect(Connect, Connack, []),
      ok = vmq_plugin_mgr:disable_module_plugin(
        on_register, ?MODULE, hook_on_register_changed_subscriber_id, 3),
      ok = vmq_plugin_mgr:disable_module_plugin(
        auth_on_register, ?MODULE, hook_change_subscriber_id, 5),
      ok = gen_tcp:close(Socket).
  
  