@Test
public void testConstruction() throws Exception, PacketParserException {

    PacketParser parser = new HandshakeBeginPacket().getParser();
    HandshakeBeginPacket.Flags flags = new HandshakeBeginPacket.Flags();
    flags.setRegistered(true);
    flags.setHandshakeRequest(true);
    flags.setRequestsReturnService(true);
    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, flags.toByte()
    };
    HandshakeBeginPacket packet = (HandshakeBeginPacket) parser.parse(new PacketBuffer().write(buffer));
    assertArrayEquals(new byte[]{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}, packet.getKey().getFingerPrint());
    assertTrue(packet.getFlags().isRegistered());
    assertTrue(packet.getFlags().isHandshakeRequest());
    assertTrue(packet.getFlags().isRequestsReturnService());
}