anchor.diff:  %%--------------------------------------------------------------------
   %% Internal Functions
   %%--------------------------------------------------------------------
  +
  +check_transport_health(State) ->
  +    case is_transport_available(State#state.transport_pid) of
  +        true -> ok;
  +        _ -> case State#state.failed_health_checks > ?HEALTH_CHECK_THRESHOLD of
  +                true  -> dead;
  +                _     -> unhealthy
  +             end
  +    end.
   
   send_data_to_server(Data) ->
       {ok, Url} = application:get_env(chloe, application_server_url),
  
positive.code: -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
           terminate/2, code_change/3]).
  
  -record(state, {transport_pid, messages}).
  
  %%--------------------------------------------------------------------
  %% API functions
  
negative.code:         _  -> NewState = State#state{messages = []},
                gen_server:cast(TransportPid, {send, [Messages]})
      end,
      {noreply, NewState#state{transport_pid = TransportPid}, ?TIMEOUT}.
  
  handle_info(timeout, State) ->
      case check_transport_health(State) of
          dead      -> error_logger:info_msg("Session is dead!"),
                       {stop, normal, State};
          unhealthy -> error_logger:info_msg("Session is unhealthy!"),
                       {noreply,
                        State#state{failed_health_checks=State#state.failed_health_checks + 1},
                        ?TIMEOUT};
          ok        -> error_logger:info_msg("Session is fine"),
                       {noreply,
                        State#state{failed_health_checks=0},
                        ?TIMEOUT}
      end;
  % TODO (trotter): We're getting weird messages from the app server,
  %                 need to investigate.
  handle_info(_Info, State) ->
      {noreply, State, ?TIMEOUT}.
  
  terminate(_Reason, _State) ->
      ok.
  