anchor.diff:              {stop, Reason, State}
       end;
   
  -handle_info({Closed, _}, State = #state{closed = Closed}) ->
  -    {stop, normal, State};
  -
   handle_info({Error, Socket, Reason}, State = #state{error = Error}) ->
       ?warning("Connection ~p error: ~p", [Socket, Reason]),
       {stop, Reason, State};
   
  +handle_info({Closed, _}, State = #state{closed = Closed}) ->
  +    {stop, normal, State};
  +
   handle_info(timeout, State = #state{socket = Socket}) ->
       ?warning("Connection ~p timeout", [Socket]),
  -    {stop, normal, State};
  -
  -% TODO add api call for disconnect
  -handle_info(disconnect, State) ->
       {stop, normal, State};
   
   handle_info(Info, State) ->
  
positive.code:                     SessionId, ProviderId, Domain, Host, Port,
                      Transport, Timeout
                  ),
                  ok = proc_lib:init_ack({ok, self()}),
                  protocol_utils:reset_reconnect_interval(ProviderId, Intervals),
                  gen_server2:enter_loop(?MODULE, [], State, ?PROTO_CONNECTION_TIMEOUT)
              catch
  
negative.code:     {noreply, NewState :: state()} |
      {noreply, NewState :: state(), timeout() | hibernate} |
      {stop, Reason :: term(), NewState :: state()}.
  handle_cast(disconnect, State) ->
      {stop, normal, State};
  handle_cast({send, Msg}, #state{status = ready} = State) ->
      case send_message(State, Msg) of
          {ok, NewState} ->
  