src/main/java/org/jivesoftware/smack/Connection.java
public void addPacketListener(PacketListener packetListener,
            PacketFilter packetFilter) {
        if (packetListener == null) {
            throw new NullPointerException("Packet listener is null.");
        }
        ListenerWrapper wrapper = new ListenerWrapper(packetListener,
                packetFilter);
        recvListeners.put(packetListener, wrapper);
    }
public void addPacketListener(PacketListener packetListener,
            PacketFilter packetFilter) {
        if (packetListener == null) {
            throw new NullPointerException("Packet listener is null.");
        }
        ListenerWrapper wrapper = new ListenerWrapper(packetListener,
                packetFilter);
        recvListeners.put(packetListener, wrapper);
    }
public void addPacketListener ( PacketListener packetListener , PacketFilter packetFilter ) { if ( packetListener == null ) { throw new NullPointerException ( "Packet listener is null." ) ; } ListenerWrapper wrapper = new ListenerWrapper ( packetListener , packetFilter ) ; recvListeners . put ( packetListener , wrapper ) ; }
Registers a packet listener with this connection. A packet listener will
be invoked only when an incoming packet is received. A packet filter
determines which packets will be delivered to the listener. If the same
packet listener is added again with a different filter, only the new
filter will be used.

<p>
NOTE: If you want get a similar callback for outgoing packets, see
{@link #addPacketInterceptor(PacketInterceptor, PacketFilter)}.

@param packetListener
the packet listener to notify of new received packets.
@param packetFilter
the packet filter to use.
Registers a packet listener with this connection . A packet listener will be invoked only when an incoming packet is received . A packet filter determines which packets will be delivered to the listener . If the same packet listener is added again with a different filter only the new filter will be used .