anchor.diff:  
   -spec sockname(socket_state()) -> {ok, endpoint()} | {error, inet:posix()}.
   sockname(#socket_state{sockmod = SockMod,
  -		       socket = Socket}) ->
  -    case SockMod of
  -      gen_tcp -> inet:sockname(Socket);
  -      _ -> SockMod:sockname(Socket)
  +		       socket = Socket,
  +		       sock_peer_name = SockPeer}) ->
  +    case SockPeer of
  +	none ->
  +	    case SockMod of
  +		gen_tcp -> inet:sockname(Socket);
  +		_ -> SockMod:sockname(Socket)
  +	    end;
  +	{SN, _} ->
  +	    {ok, SN}
       end.
   
   -spec peername(socket_state()) -> {ok, endpoint()} | {error, inet:posix()}.
   peername(#socket_state{sockmod = SockMod,
  -		       socket = Socket}) ->
  -    case SockMod of
  -      gen_tcp -> inet:peername(Socket);
  -      _ -> SockMod:peername(Socket)
  +		       socket = Socket,
  +		       sock_peer_name = SockPeer}) ->
  +    case SockPeer of
  +	none ->
  +	    case SockMod of
  +		gen_tcp -> inet:peername(Socket);
  +		_ -> SockMod:peername(Socket)
  +	    end;
  +	{_, PN} ->
  +	    {ok, PN}
       end.
   
   activate(#socket_state{sockmod = SockMod, socket = Socket}) ->
  
positive.code: -spec new(sockmod(), socket(), [proplists:property()]) -> socket_state().
  new(SockMod, Socket, Opts) ->
      MaxStanzaSize = proplists:get_value(max_stanza_size, Opts, infinity),
      XMLStream = case get_owner(SockMod, Socket) of
  		    Pid when Pid == self() ->
  			fxml_stream:new(self(), MaxStanzaSize);
  
negative.code:                        socket            :: socket(),
  		       max_stanza_size   :: timeout(),
  		       xml_stream :: undefined | fxml_stream:xml_stream_state(),
  		       shaper = none :: none | p1_shaper:state(),
  		       sock_peer_name = none :: none | {endpoint(), endpoint()}}).
  
  -type socket_state() :: #socket_state{}.
  
  