Http2UnknownFrame extends Http2Frame { public byte[] getPayload() { return payload; } protected  Http2UnknownFrame(Http2UnknownFrameBuilder builder); byte[] getPayload(); @Override void writePayload(ByteBuffer buffer);  }
@Test public void decode() { Http2Connection connection = new Http2Connection(); ByteBuffer buffer = ByteBuffer.wrap(TestMessages.UNKNOWN_PAYLOAD_BUFFER); Http2UnknownFrame frame = (Http2UnknownFrame) connection.decode(buffer); assertNotNull(frame); assertEquals(2, frame.getLength()); assertEquals(255, frame.getType() & 0x00FF); assertEquals(0x00, frame.getFlags()); assertEquals(32, frame.getStreamID()); assertEquals(2, frame.getPayload().length); assertArrayEquals(new byte[] {0x0E, 0x18}, frame.getPayload()); }
@Test public void decodeWithoutPayload() { Http2Connection connection = new Http2Connection(); ByteBuffer buffer = ByteBuffer.wrap(TestMessages.UNKNOWN_NO_PAYLOAD_BUFFER); Http2UnknownFrame frame = (Http2UnknownFrame) connection.decode(buffer); assertNotNull(frame); assertEquals(0, frame.getLength()); assertEquals(255, frame.getType() & 0x00FF); assertEquals(0x00, frame.getFlags()); assertEquals(32, frame.getStreamID()); assertEquals(0, frame.getPayload().length); }