use of org.eclipse.jetty.websocket.common.WebSocketFrame in project jetty.project by eclipse.
the class TestABCase3 method testCase3_6.
/**
* Send ping frame with (RSV3 & RSV2), with no extensions defined.
* @throws Exception on test failure
*/
@Test
public void testCase3_6() throws Exception {
byte[] payload = new byte[8];
Arrays.fill(payload, (byte) 0xFF);
List<WebSocketFrame> send = new ArrayList<>();
// intentionally bad
send.add(new PingFrame().setPayload(payload).setRsv3(true).setRsv2(true));
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (Fuzzer fuzzer = new Fuzzer(this);
StacklessLogging logging = new StacklessLogging(Parser.class)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
}
}
use of org.eclipse.jetty.websocket.common.WebSocketFrame in project jetty.project by eclipse.
the class TestABCase3 method testCase3_3.
/**
* Send small text frame, send again with (RSV1 & RSV2), then ping, with no extensions defined.
* @throws Exception on test failure
*/
@Test
public void testCase3_3() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload("small"));
// intentionally bad
send.add(new TextFrame().setPayload("small").setRsv1(true).setRsv2(true));
send.add(new PingFrame().setPayload("ping"));
List<WebSocketFrame> expect = new ArrayList<>();
// echo on good frame
expect.add(new TextFrame().setPayload("small"));
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (Fuzzer fuzzer = new Fuzzer(this);
StacklessLogging logging = new StacklessLogging(Parser.class)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.PER_FRAME);
fuzzer.send(send);
fuzzer.expect(expect);
}
}
use of org.eclipse.jetty.websocket.common.WebSocketFrame in project jetty.project by eclipse.
the class TestABCase3 method testCase3_4.
/**
* Send small text frame, send again with (RSV3), then ping, with no extensions defined.
* @throws Exception on test failure
*/
@Test
public void testCase3_4() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload("small"));
// intentionally bad
send.add(new TextFrame().setPayload("small").setRsv3(true));
send.add(new PingFrame().setPayload("ping"));
List<WebSocketFrame> expect = new ArrayList<>();
// echo on good frame
expect.add(new TextFrame().setPayload("small"));
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (Fuzzer fuzzer = new Fuzzer(this);
StacklessLogging logging = new StacklessLogging(Parser.class)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.SLOW);
fuzzer.setSlowSendSegmentSize(1);
fuzzer.send(send);
fuzzer.expect(expect);
}
}
use of org.eclipse.jetty.websocket.common.WebSocketFrame in project jetty.project by eclipse.
the class TestABCase3 method testCase3_2.
/**
* Send small text frame, send again with RSV2 == true, then ping, with no extensions defined.
* @throws Exception on test failure
*/
@Test
public void testCase3_2() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload("small"));
// intentionally bad
send.add(new TextFrame().setPayload("small").setRsv2(true));
send.add(new PingFrame().setPayload("ping"));
List<WebSocketFrame> expect = new ArrayList<>();
// echo on good frame
expect.add(new TextFrame().setPayload("small"));
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (Fuzzer fuzzer = new Fuzzer(this);
StacklessLogging logging = new StacklessLogging(Parser.class)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
}
}
use of org.eclipse.jetty.websocket.common.WebSocketFrame in project jetty.project by eclipse.
the class TestABCase3 method testCase3_1.
/**
* Send small text frame, with RSV1 == true, with no extensions defined.
* @throws Exception on test failure
*/
@Test
public void testCase3_1() throws Exception {
// intentionally bad
WebSocketFrame send = new TextFrame().setPayload("small").setRsv1(true);
WebSocketFrame expect = new CloseInfo(StatusCode.PROTOCOL).asFrame();
try (Fuzzer fuzzer = new Fuzzer(this);
StacklessLogging logging = new StacklessLogging(Parser.class)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
}
}
Aggregations