/**
* process a received packet
*/
protected void processPacket(INetworkPacket np) throws Exception {
PacketMarshaller pm = marshallerFactory.getMarshaller(np
.getMarshallingType());
megamek.debug.Assert.assertTrue(pm != null, "Unknown marshalling type");
Packet packet = null;
byte[] data = np.getData();
bytesReceived += data.length;
ByteArrayInputStream bis = new ByteArrayInputStream(data);
InputStream in;
if (np.isCompressed()) {
in = new GZIPInputStream(bis);
} else {
in = bis;
}
// TBD this is stupid. pm should be always non null right?
if (pm != null) {
packet = pm.unmarshall(in);
if (packet != null) {
debugLastFewCommandsReceived.push(packet.getCommand());
processConnectionEvent(new PacketReceivedEvent(
AbstractConnection.this, packet));
}