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 .