anchor.diff:  -define(WAIT_FOR_SOCKET_CLOSE_TIMEOUT, 200).
   -define(SERVER, ?MODULE).
   
  --record(state, {owner, url, parser, sid = nil, rid = nil}).
  +-record(state, {owner,
  +                url,
  +                parser,
  +                sid = nil,
  +                rid = nil,
  +                requests = 0}).
   
   %%%===================================================================
   %%% API
  
positive.code: %%%===================================================================
  %%% Helpers
  %%%===================================================================
  send0(#transport{socket = {Host, Port, Path}}, Elem0, State) ->
      Headers = [{"Content-Type", "text/xml; charset=utf-8"}],
      Elem = wrap_elem(Elem0, State),
      Self = self(),
      AsyncReq = fun() ->
          {ok, Reply} =
              lhttpc:request(Host, Port, false, Path, 'POST',
                  Headers, exml:to_iolist(Elem), infinity, []),
          Self ! {http_reply, Reply}
      end,
      spawn_link(AsyncReq),
      State#state{rid=State#state.rid+1}.
  
  handle_data(Data, #state{owner = Owner} = State) ->
      {ok, Body} = exml:parse(Data),
  
negative.code:                 children = [#xmlelement{name = <<"presence">>,
                                     attrs = [{<<"type">>, <<"unavailable">>},
                                              {<<"xmlns">>, <<"jabber:client">>}]}]};
  
  wrap_elem(Element, #state{sid = Sid, rid=Rid}) ->
      #xmlelement{name = <<"body">>,
                  attrs = common_attrs(Rid, Sid),
                  children = [Element]}.
  
  empty_body(#state{sid = Sid, rid=Rid}) ->
      #xmlelement{name = <<"body">>,
                  attrs = common_attrs(Rid, Sid)}.
  
  common_attrs(Rid) ->
      [{<<"rid">>, pack_rid(Rid)},
  