anchor.diff:  
       % Send Header (including signed checksum)
       HeaderFrame = pushy_util:signed_header_from_message(PrivateKey, BodyFrame),
  +    lager:debug("Sending Response: header=~s,body=~s",[HeaderFrame, BodyFrame]),
       pushy_messaging:send_message(Sock, [HeaderFrame, BodyFrame]),
  -    lager:debug("Response sent: header=~s,body=~s",[HeaderFrame, BodyFrame]).
  -
  -
  -do_receive(Sock, Frame, #state{command_sock = CommandSock,
  +    State.
  +
  +-spec receive_message(Sock :: erlzmq_socket(),
  +                      Frame :: binary(),
  +                      State :: #state{}) -> #state{} | {error, bad_body | bad_header}.
  +receive_message(Sock, Frame, #state{command_sock = CommandSock,
                                  heartbeat_sock = HeartbeatSock,
                                  server_public_key = PublicKey} = State) ->
       [Header, Body] = pushy_messaging:receive_message_async(Sock, Frame),
   
  -    lager:debug("Received message~n\tA ~p~n\tH ~s~n\tB ~s", [Header, Body]),
  +    lager:debug("Received message~n\tH ~s~n\tB ~s", [Header, Body]),
       case catch pushy_util:do_authenticate_message(Header, Body, PublicKey) of
           ok ->
               case Sock of
                   CommandSock ->
  -                    process_server_command(State, Header, Body);
  +                    process_server_command(Body, State);
                   HeartbeatSock ->
  -                    process_server_heartbeat(State, Header, Body)
  +                    process_server_heartbeat(Body, State)
               end;
           {no_authn, bad_sig} ->
               lager:error("Command message failed verification: header=~s", [Header]),
  -            State
  +            {error, bad_header}
       end.
   
  -process_server_command(State, _Header, Body) ->
  +-spec process_server_command(binary(), #state{}) -> #state{} | {error, bad_body}.
  +process_server_command(Body, State) ->
       case catch jiffy:decode(Body) of
           {Data} ->
               Type = ej:get({<<"type">>}, Data),
               JobId = ej:get({<<"job_id">>}, Data),
  -            respond(Type, JobId, State),
  -            State;
  +            respond(Type, JobId, State);
           {'EXIT', Error} ->
               lager:error("Status message JSON parsing failed: body=~s, error=~s", [Body, Error]),
  -            State
  +            {error, bad_body}
       end.
   
  -process_server_heartbeat(State, _Header, Body) ->
  +-spec process_server_heartbeat(binary(), #state{}) -> #state{} | {error, bad_body}.
  +process_server_heartbeat(Body, State) ->
       case catch jiffy:decode(Body) of
           {Data} ->
               %% TODO - we should do something with these heartbeats...
  
positive.code: -behaviour(gen_server).
  -define(SERVER, ?MODULE).
  
  %% ------------------------------------------------------------------
  %% API Function Exports
  %% ------------------------------------------------------------------
  
  -export([start_link/2,
           heartbeat/1
          ]).
  
  %% ------------------------------------------------------------------
  %% Private Exports - only exported for instrumentation
  %% ------------------------------------------------------------------
  
  -export([send_heartbeat/1,
           send_response/3
          ]).
  
  %% ------------------------------------------------------------------
  
negative.code:                     server_port = Port}, InstanceId]) ->
      IncarnationId = list_to_binary(pushy_util:guid_v4()),
  
      lager:debug("Getting config from Pushy Server ~s:~w", [Hostname, Port]),
      #pushy_client_config{command_address = CommandAddress,
                           heartbeat_address = HeartbeatAddress,
                           heartbeat_interval = Interval,
                           server_public_key = PublicKey } = ?TIME_IT(pushy_client_config, get_config,
                                                                      (?PUSHY_ORGNAME, Hostname, Port)),
  
      NodeId = list_to_binary(io_lib:format("~s-~4..0B", [ClientName, InstanceId])),
      lager:info("Starting pushy client with node id ~s (~s).", [NodeId, IncarnationId]),
  
  
      {ok, HeartbeatSock} = ?TIME_IT(?MODULE, connect_to_heartbeat, (Ctx, HeartbeatAddress)),
      {ok, CommandSock} = ?TIME_IT(?MODULE, connect_to_command, (Ctx, CommandAddress)),
  
      {ok, PrivateKey} = chef_keyring:get_key(client_private),
  
      State = #state{command_sock = CommandSock,
                     heartbeat_sock = HeartbeatSock,
  