src/main/java/org/jivesoftware/smack/Connection.java
public void addPacketSendingListener(PacketListener packetListener,
            PacketFilter packetFilter) {
        if (packetListener == null) {
            throw new NullPointerException("Packet listener is null.");
        }
        ListenerWrapper wrapper = new ListenerWrapper(packetListener,
                packetFilter);
        sendListeners.put(packetListener, wrapper);
    }
public void addPacketSendingListener(PacketListener packetListener,
            PacketFilter packetFilter) {
        if (packetListener == null) {
            throw new NullPointerException("Packet listener is null.");
        }
        ListenerWrapper wrapper = new ListenerWrapper(packetListener,
                packetFilter);
        sendListeners.put(packetListener, wrapper);
    }
Registers a packet listener with this connection. The listener will be
notified of every packet that this connection sends. A packet filter
determines which packets will be delivered to the listener. Note that the
thread that writes packets will be used to invoke the listeners.
Therefore, each packet listener should complete all operations quickly or
use a different thread for processing.

@param packetListener
the packet listener to notify of sent packets.
@param packetFilter
the packet filter to use.