anchor.diff:                  _ ->
                       process_flag(trap_exit, true)
               end,
  -            {next_state, connected,
  +            {reply, ok, connected,
                NewState#state{keep_alive_timer=gen_fsm:send_event_after(KeepAlive,
                                                              keepalive_expired)}};
           {NextStateName, NewState} ->
  -            {next_state, NextStateName, NewState, ?CLOSE_AFTER};
  +            {reply, ok, NextStateName, NewState, ?CLOSE_AFTER};
           Ret -> Ret
       end;
  -handle_event(disconnect, StateName, State) ->
  -    lager:debug("[~p] stop in state ~p due to ~p~n",
  -                  [self(), StateName, disconnect]),
  -    {stop, normal, State}.
  -
  --spec handle_sync_event(_, _, _, state()) -> {reply, _, statename(), state()} |
  -                                             {stop, {error, {unknown_req, _}},
  -                                              state()}.
   handle_sync_event({get_info, Items}, _From, StateName, State) ->
       Reply = get_info_items(Items, StateName, State),
       {reply, Reply, StateName, State};
  
positive.code:                                   retry_interval=1000 * RetryInterval
                                   }, ?CLOSE_AFTER}.
  
  -spec handle_event({input, mqtt_frame()}, _, state()) ->
      {stop, normal, state()} | {next_state, statename(), state()}.
  handle_event({input, #mqtt_frame{fixed=#mqtt_frame_fixed{type=?DISCONNECT}}},
               _, State) ->
      {stop, normal, State};
  handle_event({input, Frame}, StateName, State) ->
      #state{keep_alive_timer=KARef, recv_cnt=RecvCnt} = State,
      #mqtt_frame{fixed=Fixed,
                  variable=Variable,
  
negative.code: 
  -spec in(pid(), mqtt_frame()) ->  ok.
  in(FsmPid, Event) ->
      gen_fsm:sync_send_all_state_event(FsmPid, {input, Event}).
  
  -spec get_info(string() | pid(), [atom()]) -> proplist().
  get_info(ClientId, InfoItems) when is_list(ClientId) ->
  