@Override
        public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed)
                throws PacketRejectedException {

            if (ping.getTo() == null || packet.getFrom() == null || packet.getTo() == null) {
                return;
            }

            if (!processed
                    && (ping.getTo().getDomain().equals(packet.getFrom().getDomain()) || ping.getTo().getDomain().equals(packet.getTo().getDomain()))) {

                // Log all traffic to and from the domain.
                xml.append(packet.toXML());
                xml.append('\n');

                // If we've received our IQ response, stop the test.
                if ( packet instanceof IQ )
                {
                    final IQ iq = (IQ) packet;
                    if ( iq.isResponse() && ping.getID().equals( iq.getID() ) && ping.getTo().equals( iq.getFrom() ) ) {
                        Log.info("{} server to server response received.", iq.getType() == Type.result ? "Successful" : "Erroneous");
                        waitUntil.release();
                    }
                }
            }
        }
Keeps a log of the XMPP traffic, releasing the wait lock on response received.
xmppserver/src/main/java/org/jivesoftware/util/S2STestService.java