anchor.diff:          {ok, NewState} ->
               activate_socket_once(NewState),
               {noreply, NewState, ?PROTO_CONNECTION_TIMEOUT};
  +        % Serialization error should not break connection
  +        {error, serialization_failed} ->
  +            {noreply, State, ?PROTO_CONNECTION_TIMEOUT};
           {error, Reason} ->
               {stop, Reason, State}
       end;
  
positive.code:     {noreply, NewState :: state(), timeout() | hibernate} |
      {stop, Reason :: term(), Reply :: term(), NewState :: state()} |
      {stop, Reason :: term(), NewState :: state()}.
  handle_call({send, #server_message{} = Msg}, _From, #state{type = outgoing} = State) ->
      send_message_sync(State, to_client_message(Msg));
  handle_call({send, #client_message{} = Msg}, _From, #state{type = outgoing} = State) ->
      send_message_sync(State, Msg);
  handle_call({send, #server_message{} = Msg}, _From, #state{type = incoming} = State) ->
      send_message_sync(State, Msg);
  handle_call(_Request, _From, State) ->
      ?log_bad_request(_Request),
      {reply, {error, wrong_request}, State, ?PROTO_CONNECTION_TIMEOUT}.
  
  
  %%--------------------------------------------------------------------
  %% @private
  %% @doc
  %% Tries to send message to peer if connection is in `ready` state and
  %% provides feedback about eventual failure (e.g. serialization error or
  %% not ready connection). In case of socket errors it also stops
  %% connection process.
  %% @end
  %%--------------------------------------------------------------------
  -spec send_message_sync(state(), message()) ->
      {reply, Reply :: term(), NewState :: state(), timeout() | hibernate} |
      {stop, Reason :: term(), Reply :: term(), NewState :: state()}.
  send_message_sync(#state{status = ready} = State, Msg) ->
      case send_message(State, Msg) of
          {ok, NewState} ->
              {reply, ok, NewState, ?PROTO_CONNECTION_TIMEOUT};
          {error, serialization_failed} = SerializationError ->
              {reply, SerializationError, State, ?PROTO_CONNECTION_TIMEOUT};
          Error ->
              {stop, Error, Error, State}
      end;
  send_message_sync(#state{status = Status} = State, _Msg) ->
      {reply, {error, Status}, State, ?PROTO_CONNECTION_TIMEOUT}.
  
  
  %%--------------------------------------------------------------------
  
negative.code:         ok ->
              {ok, State};
          {ok, ServerMsg} ->
              send_server_message(State, ServerMsg);
          {error, Reason} ->
              ?warning("Message ~p handling error: ~p", [Msg, Reason]),
              {ok, State}
  