anchor.diff:      log(debug, ?MODULE, handle_cast, [Function, self()],
           "Send cast.", ?LINE, Module),
       doSendPacket(Socket, {rpc, Function, Args}),
  -    {noreply, State, ?Timeout};
  +    {noreply, State};
   handle_cast({cast, Function, Args}, State = #state{socket = Socket,
                                                      module = Module}) ->
       log(debug, ?MODULE, handle_cast, [Function, self()],
           "Send cast.", ?LINE, Module),
       doSendPacketSSL(Socket, {rpc, Function, Args}),
  -    {noreply, State, ?Timeout};
  +    {noreply, State};
   handle_cast({stop, Offender}, State = #state{module = Module}) ->
       log(debug, ?MODULE, stop, [State, self(), Offender],
           "Shutting down, stop received.", ?LINE, Module),
       {stop, normal, State};
   handle_cast(_Msg, State) ->
  -    {noreply, State, ?Timeout}.
  +    {noreply, State}.
   
   %%--------------------------------------------------------------------
   %% @private
  
positive.code:     case catch ssl:connect(Host, Port,
                             [{packet, 4}, {active, once}, binary | SSLOptions], 10000) of
          {ok, Socket} ->
              {ok, #state{socket = Socket,
                          module = Module,
                          client = true,
                          ssl    = {true, SSLOptions}},  ?Timeout};
          Reason ->
              log(debug, ?MODULE, init, [Reason, self()],
                  "Shutting down, failed to establish connection.",
  
negative.code: handle_info({rpc_result, Result, From}, State = #state{socket = Socket,
                                                         ssl    = false}) ->
      doSendPacket(Socket, {rpc_result, Result, From}),
      {noreply, State};
  handle_info({rpc_result, Result, From}, State = #state{socket = Socket}) ->
      doSendPacketSSL(Socket, {rpc_result, Result, From}),
      {noreply, State};
  handle_info(timeout, State = #state{socket = Socket,
                                      client = true,
                                      ssl    = false,
                                      module = Module}) ->
      doSendPacket(Socket, ping),
  
      %% If we havent received a pong signal withing 60 sek, close connection.
      Ref = erlang:send_after(60000, self(), lostConnection),
  
      erlang:send_after(?Timeout, self(), timeout),
  
      log(debug, ?MODULE, handle_info, [Socket],
          "Sending ping to socket...", ?LINE, Module),
  
      {noreply, State#state{timerRef = Ref}};
  handle_info(timeout, State = #state{socket = Socket,
                                      client = true,
                                      module = Module}) ->
      doSendPacketSSL(Socket, ping),
  
      %% If we havent received a pong signal withing 60 sek, close connection.
      Ref = erlang:send_after(60000, self(), lostConnection),
  
      erlang:send_after(?Timeout, self(), timeout),
  
      log(debug, ?MODULE, handle_info, [Socket],
          "Sending ping to socket...", ?LINE, Module),
  
      {noreply, State#state{timerRef = Ref}};
  handle_info(timeout, State = #state{client = false}) ->
      {noreply, State};
  handle_info(lostConnection, State = #state{module = Module}) ->
      log(error, ?MODULE, handle_info, [State, self()],
          "Lost connection signal received, shutting down...", ?LINE, Module),
      {stop, normal, State};
  handle_info(_Info, State) ->
      {noreply, State}.
  
  
  
  