@Test
public void testRunPacketParser() throws Exception {

    byte[] buffer = new byte[]{
            (byte) PACKETS.HANDSHAKE_OPEN.ordinal(), 0, 2, 4, 8, 16, 32, 64, 2, 4, 8, 16, 32, 64, 2, 4, 8, 16, 32, 64, 2, 4, 8, 16, 32, 64, 2, 4, 8, 16, 32, 64, 0, 1
    };
    PacketBuffer packetBuffer = new PacketBuffer();
    handler.initPacketBuffer(packetBuffer);
    packetBuffer.write(buffer);
    Session niceMock = EasyMock.createNiceMock(Session.class);
    expect(niceMock.getExpecting()).andReturn(PACKETS.HANDSHAKE_OPEN);
    replay(niceMock);
    Packet packet = handler.runPacketParser(packetBuffer, null, PACKETS.HANDSHAKE_OPEN);
    packetBuffer.resize(0, 500);
    assertEquals(0, packetBuffer.getOffset());
}