I wrote a small test client using 4.4.0-alpha2. I added some code that intents to log all stanzas (and major events), by doing this:
connection.addAsyncStanzaListener( stanza -> Log.info( "Recv: {}", stanza.toXML() ), stanza -> true );
connection.addStanzaSendingListener( stanza -> Log.info( "Send: {}", stanza.toXML() ), stanza -> true );
connection.addStanzaDroppedListener( stanza -> Log.warn( "Dropped: {}", stanza.toXML() ) );
connection.addConnectionListener(new ConnectionListener() {
@Override public void connected( final XMPPConnection xmppConnection ) { Log.info("Connected"); }
@Override public void authenticated( final XMPPConnection xmppConnection, final boolean b ) { Log.info("authenticated: {}", b); }
@Override public void connectionClosed() { Log.warn("Connection closed"); }
@Override public void connectionClosedOnError( final Exception e ) { Log.warn("Connection closed with error", e); }
});
This generated the following log file.
20:15:42.474 client-1: Connected
20:15:42.618 client-1: Send: <iq xmlns='jabber:client' id='TSVEF-3' type='set'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>client-1</resource></bind></iq>
20:15:42.621 client-1: Recv: <iq xmlns='jabber:client' to='laptop-guus/7eui9smspz' id='TSVEF-3' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>leela@laptop-guus/client-1</jid></bind></iq>
20:15:42.626 client-1: Send: <iq xmlns='jabber:client' id='TSVEF-5' type='get'><query xmlns='jabber:iq:roster'></query></iq>
20:15:42.627 client-1: authenticated: false
\20:15:42.627 client-1: Recv: <iq xmlns='jabber:client' to='leela@laptop-guus/client-1' id='TSVEF-5' type='result'><query xmlns='jabber:iq:roster' ver='102849665'></query></iq>
20:15:42.630 client-1: Send: <presence xmlns='jabber:client' id='TSVEF-7'><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='https://igniterealtime.org/projects/smack' ver='NfJ3flI83zSdUDzCEICtbypursw='/></presence>
20:15:42.634 client-1: Recv: <presence xmlns='jabber:client' to='leela@laptop-guus/client-1' from='leela@laptop-guus/client-1' id='TSVEF-7'><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='https://igniterealtime.org/projects/smack' ver='NfJ3flI83zSdUDzCEICtbypursw='/></presence>
20:15:47.631 client-1: Send: <iq xmlns='jabber:client' to='laptop-guus' id='326-23' type='error'><error xmlns='jabber:client' type='modify'><not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
20:18:47.830 client-1: Send: <iq xmlns='jabber:client' to='laptop-guus' id='21-24' type='result'></iq>
20:21:48.029 client-1: Send: <iq xmlns='jabber:client' to='laptop-guus' id='930-25' type='result'></iq>
This log contains IQ responses to requests that have not been logged. I expected the code to log everything that’s received, but apparently, that’s not the case. Shouldn’t it?