anchor.diff:           get_rid/1,
            get_keepalive/1,
            set_keepalive/2,
  -         pause/2]).
  +         pause/2,
  +         get_active/1,
  +         set_active/2,
  +         recv/1]).
   
   -define(WAIT_FOR_SOCKET_CLOSE_TIMEOUT, 200).
   -define(SERVER, ?MODULE).
  
positive.code:                 rid = nil,
                  requests = 0,
                  keepalive = true,
                  wait}).
  
  %%%===================================================================
  %%% API
  
negative.code:             State
      end,
      Stanzas = unwrap_elem(Body),
      case State#state.active of
          true ->
              forward_to_owner(Stanzas, NewState),
              NewState;
          false ->
              store_reply(Body, NewState)
      end.
  
  forward_to_owner(Stanzas, #state{owner = Owner} = S) ->
      lists:foreach(fun(Stanza) ->
          Owner ! {stanza, transport(S), Stanza}
      end, Stanzas),
      case lists:keyfind(xmlstreamend, 1, Stanzas) of
          false ->
              ok;
          _ ->
              gen_server:cast(self(), stop)
      end.
  
  store_reply(Body, #state{replies = Replies} = S) ->
      S#state{replies = Replies ++ [Body]}.
  
  handle_recv(#state{replies = []} = S) ->
      {empty, S};
  handle_recv(#state{replies = [Reply | Replies]} = S) ->
      case Reply of
          #xmlstreamend{} ->
              gen_server:cast(self(), stop);
          _ -> ok
      end,
      {Reply, S#state{replies = Replies}}.
  
  transport(#state{url = Url}) ->
      #transport{module = ?MODULE,
  