anchor.diff:                              lager:error("Error ~p opening a channel on connection with params ~p~n", [ChannelOpenError, AMQPParams]),
                               erlang:demonitor(ConnMonRef, [flush]),
                               ok = rabl_amqp:connection_close(Connection),
  +                            erlang:send_after(Delay, self(), connect_timeout),
                               {next_state, disconnected, State#state{reconnect_delay_millis=Delay2,
  -                                                                   connection_attempt_counter=CAC+1}, Delay}
  +                                                                   connection_attempt_counter=CAC+1}}
                       end;
                   {error, ConnectionOpenError} ->
                       lager:error("Error ~p connecting with params ~p~n", [ConnectionOpenError, AMQPParams]),
  +                    erlang:send_after(Delay, self(), connect_timeout),
                       {next_state, disconnected, State#state{reconnect_delay_millis=Delay2,
  -                                                           connection_attempt_counter=CAC+1}, Delay}
  +                                                           connection_attempt_counter=CAC+1}}
               end
       end.
   
  
positive.code:                           {next_state, consumer_state(), #state{}, timeout()} |
                            {stop, Reason::atom(), #state{}}.
  disconnected(timeout, State) ->
      connect(State).
  
  %%--------------------------------------------------------------------
  
negative.code:                        {next_state, consumer_state(), #state{}} |
                         {next_state, consumer_state(), #state{}, timeout()} |
                         {stop, Reason::atom(), #state{}}.
  unsubscribed(connect_timeout, State) ->
      lager:info("connect_timeout in state unsubscribed"),
      subscribe(State).
  
  %%--------------------------------------------------------------------
  