use of org.eclipse.jetty.websocket.api.WebSocketPolicy in project jetty.project by eclipse.
the class TestABCase1_2 method testParse65535ByteBinaryCase1_2_6.
@Test
public void testParse65535ByteBinaryCase1_2_6() {
int length = 65535;
ByteBuffer expected = ByteBuffer.allocate(length + 5);
expected.put(new byte[] { (byte) 0x82 });
// no masking
byte b = 0x00;
b |= 0x7E;
expected.put(b);
expected.put(new byte[] { (byte) 0xff, (byte) 0xff });
for (int i = 0; i < length; ++i) {
expected.put("*".getBytes());
}
expected.flip();
WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.CLIENT);
policy.setMaxBinaryMessageSize(length);
Parser parser = new UnitParser(policy);
IncomingFramesCapture capture = new IncomingFramesCapture();
parser.setIncomingFramesHandler(capture);
parser.parse(expected);
capture.assertNoErrors();
capture.assertHasFrame(OpCode.BINARY, 1);
Frame pActual = capture.getFrames().poll();
Assert.assertThat("BinaryFrame.payloadLength", pActual.getPayloadLength(), is(length));
// Assert.assertEquals("BinaryFrame.payload",length,pActual.getPayloadData().length);
}
Aggregations