anchor.diff:  
   
   %% @private
  +-spec handle_protocol_upgrade(state(), Data :: binary()) ->
  +    {ok, state()} | {error, Reason :: term()}.
  +handle_protocol_upgrade(State, Data) ->
  +    case protocol_utils:verify_protocol_upgrade_response(Data) of
  +        false ->
  +            ?error("Received invalid protocol upgrade response: ~p", [Data]),
  +            {error, invalid_protocol_upgrade_response};
  +        true ->
  +            {ok, MsgId} = message_id:generate(self()),
  +            {ok, Nonce} = authorization_nonce:create(),
  +            ClientMsg = #client_message{
  +                message_id = MsgId,
  +                message_body = #provider_handshake_request{
  +                    provider_id = oneprovider:get_id(),
  +                    nonce = Nonce
  +                }
  +            },
  +            #state{socket = Socket, transport = Transport} = State,
  +            ok = Transport:setopts(Socket, [binary, {packet, ?PACKET_VALUE}]),
  +            send_client_message(State, ClientMsg)
  +    end.
  +
  +
  +%% @private
   -spec handle_handshake(state(), binary()) ->
       {ok, state()} | {error, Reason :: term()}.
   handle_handshake(#state{type = incoming} = State, Data) ->
  
positive.code:         {ok, NewState} ->
              activate_socket_once(NewState),
              {noreply, NewState, ?PROTO_CONNECTION_TIMEOUT};
          {error, Reason} ->
              {stop, Reason, State}
      end;
  
negative.code: %% @private
  -spec send_message(state(), message()) ->
      {ok, state()} | {error, Reason :: term()}.
  send_message(#state{type = outgoing} = State, #client_message{} = Msg) ->
      send_client_message(State, Msg);
  send_message(#state{type = incoming} = State, #server_message{} = Msg) ->
      send_server_message(State, Msg);
  send_message(#state{type = ConnType}, Msg) ->
      ?warning("Attempt to send msg ~p via incorrect connection ~p", [
          Msg, ConnType
      ]),
      {error, sending_msg_via_wrong_connection}.
  
  
  %% @private
  