/** * Creates a packet from a byte array and fires listeners. * @param packetData * @param sender */ private void dispatchPacket(byte[] packetData, Destination sender) { CommunicationPacket packet; try { packet = CommunicationPacket.createPacket(packetData); logPacket(packet, sender); firePacketReceivedEvent(packet, sender); } catch (MalformedPacketException e) { log.warn("Ignoring unparseable packet.", e); firePacketReceivedEvent(new MalformedCommunicationPacket(), sender); } }