anchor.diff:  
       ConnectOpts = secure_ssl_opts:expand(Host, SslOpts),
       {ok, Socket} = Transport:connect(binary_to_list(Host), Port, ConnectOpts, Timeout),
  -
  -    {Ok, Closed, Error} = Transport:messages(),
  +    self() ! upgrade_protocol,
   
       session_manager:reuse_or_create_provider_session(
           SessionId, provider_outgoing, #user_identity{
  
positive.code: %%--------------------------------------------------------------------
  %% @private
  %% @doc
  %% If socket_mode is set to active_always does nothing because it was
  %% already set during connection creation and every received packet will
  %% be send to process as erlang message.
  %% Otherwise (active_once) activates socket so that only next received packet
  %% will be send to process as erlang message.
  %% @end
  %%--------------------------------------------------------------------
  -spec activate_socket_once(state()) -> ok.
  activate_socket_once(#state{socket_mode = active_always}) ->
      ok;
  activate_socket_once(#state{transport = Transport, socket = Socket}) ->
      ok = Transport:setopts(Socket, [{active, once}]).
  
negative.code:             message_body = #handshake_response{status = 'OK'}
          })
      catch Type:Reason ->
          ?debug("Invalid handshake request - ~p:~p", [Type, Reason]),
          send_server_message(State, auth_manager:get_handshake_error(Reason)),
          {error, Reason}
      end.
  