class Socks5IqHandler extends DefaultIQHandler {

    @Override
    protected List<Stanza> handleGet(IQStanza stanza, ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, StanzaBroker stanzaBroker) {
        /*
            C: <iq from='requester@example.com/foo'
                    id='uj2c15z9'
                    to='streamer.example.com'
                    type='get'>
                  <query xmlns='http://jabber.org/protocol/bytestreams'/>
               </iq>
            
            S: <iq from='streamer.example.com'
                    id='uj2c15z9'
                    to='requester@example.com/foo'
                    type='result'>
                  <query xmlns='http://jabber.org/protocol/bytestreams'>
                    <streamhost
                        host='24.24.24.1'
                        jid='streamer.example.com'
                        port='7625'/>
                  </query>
                </iq>
         */
        
        StanzaBuilder builder = StanzaBuilder.createIQStanza(stanza.getTo(), stanza.getFrom(), IQStanzaType.RESULT, stanza.getID())
            .startInnerElement("query", NamespaceURIs.XEP0065_SOCKS5_BYTESTREAMS)
            .startInnerElement("streamhost", NamespaceURIs.XEP0065_SOCKS5_BYTESTREAMS);
        
        // if an address is provided on the proxy address, use that, else use the JID
        if(DEFAULT_ADDRESS.equals(proxyAddress.getAddress())) {
            builder.addAttribute("host", jid.getFullQualifiedName());
        } else {
            builder.addAttribute("host", proxyAddress.getHostName());
        }
        builder.addAttribute("jid", jid.getFullQualifiedName())
            .addAttribute("port", Integer.toString(proxyAddress.getPort()));
        
        return Collections.singletonList(builder.build());
    }

    public  Socks5IqHandler(Entity jid, InetSocketAddress proxyAddress, Socks5ConnectionsRegistry connections);

}