public PacketHandler getHandler ( byte [ ] packet ) { synchronized ( this . handlers ) { // Search for the first handler capable of processing the packet for ( PacketHandler protocolHandler : this . handlers ) { if ( protocolHandler . canHandle ( packet ) ) { return protocolHandler ; } } // Return null in case no handler is capable of decoding the packet return null ; } }
Gets the protocol handler capable of processing the packet .