Esp2PacketHeader { public int getPacketSize() { return ESP2_HEADER_SIZE + length; } Esp2PacketHeader(byte[] headerData);  Esp2PacketHeader(PacketType packetType, int length); @Override String toString(); int getLength(); PacketType getPacketType(); byte[] asByteArray(); int getPacketSize(); static final byte ESP2_SYNC_BYTE_1; static final byte ESP2_SYNC_BYTE_2; static final int ESP2_HEADER_SIZE; static final int ESP2_HEADER_SYNC_BYTE_1_INDEX; static final int ESP2_HEADER_SYNC_BYTE_1_LENGTH; static final int ESP2_HEADER_SYNC_BYTE_2_INDEX; static final int ESP2_HEADER_SYNC_BYTE_2_LENGTH; static final int ESP2_HEADER_H_SEQ_LENGTH_INDEX; }
@Test public void testPacketSize() throws Exception { int length = 11; byte[] headerData = headerAsByteArray(length, Esp2PacketHeader.PacketType.TCT); Esp2PacketHeader header = new Esp2PacketHeader(headerData); Assert.assertTrue(14 == header.getPacketSize()); }