{
long expectedID = previousId + 1;
byte[] header = getAmqpHeader(version);
assertNotNull("protocol header should not be null", header);
ServerProtocolEngine engine = factory.newProtocolEngine();
TestNetworkConnection conn = new TestNetworkConnection();
engine.setNetworkConnection(conn, conn.getSender());
assertEquals("ID did not increment as expected", expectedID, engine.getConnectionId());
//actually feed in the AMQP header for this protocol version, and ensure the ID remains consistent
engine.received(ByteBuffer.wrap(header));
assertEquals("ID was not as expected following receipt of the AMQP version header", expectedID, engine.getConnectionId());
previousId = expectedID;
engine.closed();
}
}