use of org.eclipse.jetty.websocket.common.test.Fuzzer in project jetty.project by eclipse.
the class TestABCase4 method testCase4_2_3.
/**
* Send small text, then frame with opcode 13 (reserved), then ping
* @throws Exception on test failure
*/
@Test
public void testCase4_2_3() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload("hello"));
// intentionally bad
send.add(new BadFrame((byte) 13));
send.add(new PingFrame());
List<WebSocketFrame> expect = new ArrayList<>();
// echo
expect.add(new TextFrame().setPayload("hello"));
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.test.Fuzzer in project jetty.project by eclipse.
the class TestABCase7 method testCase7_3_3.
/**
* close with valid payload (payload length 2)
* @throws Exception on test failure
*/
@Test
public void testCase7_3_3() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (Fuzzer fuzzer = new Fuzzer(this)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
fuzzer.expectNoMoreFrames();
}
}
use of org.eclipse.jetty.websocket.common.test.Fuzzer in project jetty.project by eclipse.
the class TestABCase7 method testCase7_1_3.
/**
* Close frame, then ping frame (no pong received)
* @throws Exception on test failure
*/
@Test
public void testCase7_1_3() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
send.add(new PingFrame().setPayload("out of band ping"));
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (Fuzzer fuzzer = new Fuzzer(this)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
fuzzer.expectNoMoreFrames();
}
}
use of org.eclipse.jetty.websocket.common.test.Fuzzer in project jetty.project by eclipse.
the class TestABCase7 method testCase7_3_1.
/**
* close with no payload (payload length 0)
* @throws Exception on test failure
*/
@Test
public void testCase7_3_1() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new CloseFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseFrame());
try (Fuzzer fuzzer = new Fuzzer(this)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
fuzzer.expectNoMoreFrames();
}
}
use of org.eclipse.jetty.websocket.common.test.Fuzzer in project jetty.project by eclipse.
the class TestABCase7 method testCase7_1_1.
/**
* Basic message then close frame, normal behavior
* @throws Exception on test failure
*/
@Test
public void testCase7_1_1() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload("Hello World"));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new TextFrame().setPayload("Hello World"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (Fuzzer fuzzer = new Fuzzer(this)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
}
}
Aggregations