anchor.diff:      {next_state, StateName, State};
   
   handle_event(#frame{ command = "SEND", headers = Headers } = Frame, StateName, State) ->
  -    {next_state, StateName, State};
  +    {next_state, StateName, State#state{ frames_in = ?state.frames_in + 1 }};
   
   handle_event(Event, StateName, State) ->
       ?log([{state_name, StateName}, {handle_event, Event}]),
  
positive.code: %% @doc
  %% gen_fsm callback
  %%
  terminate(_Reason, _StateName, _State) ->
      ?log(stopped),
      ok.
  
  %% @spec code_change(OldVsn, StateName, State, Extra) -> Result
  
negative.code:     {stop, Reason, State};
  
  handle_event(#frame{ command = "CONNECT", headers = Headers } = Frame, StateName, State) ->
      Login = proplists:get_value("login", Headers),
      Passcode = proplists:get_value("passcode", Headers),
      case simplemq_server:auth(Login, Passcode) of
          ok ->
              F = #frame{
                  command = "CONNECTED",
                  headers = [{"session", ?state.session}]
              },
              ok = send_frame(?state.socket, F),
              {next_state, StateName, State};
          _ ->
              gen_fsm:send_all_state_event(self(), {error, auth_failed, Frame}),
              {next_state, StateName, State}
  