anchor.diff:      lists:reverse(Acc);
   do_wait_for_stanzas(#client{event_client=EventClient} = Client,
                       Count, TimeoutMsg, Acc) ->
  -    Conn = Client#client{jid = undefined},
  +    Transport = get_transport_for(Client),
       receive
  -        {stanza, Conn, Stanza} ->
  +        {stanza, Transport, Stanza} ->
               escalus_event:pop_incoming_stanza(EventClient, Stanza),
               do_wait_for_stanzas(Client, Count - 1, TimeoutMsg, [Stanza|Acc]);
           %% FIXME: stream error
  
positive.code: kill(#client{module = escalus_tcp, rcv_pid = Pid}) ->
      erlang:exit(Pid, kill).
  
  peek_stanzas(Conn) ->
      {messages, Msgs} = process_info(self(), messages),
      lists:flatmap(fun ({stanza, MConn, Stanza}) when MConn == Conn ->
                            [Stanza];
                        %% FIXME: stream error
                        (_) ->
  
negative.code:     {server, S} = lists:keyfind(server, 1, Proplist),
      {resource, R} = lists:keyfind(resource, 1, Proplist),
      <<U/binary,"@",S/binary,"/",R/binary>>.
  
  get_transport_for(Client) ->
      Client#client{jid = undefined}.