use of org.eclipse.jetty.websocket.common.frames.PongFrame in project jetty.project by eclipse.
the class TestABCase5 method testCase5_6.
/**
* Send text fragmented in 2 packets, with ping between them
* @throws Exception on test failure
*/
@Test
public void testCase5_6() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload("hello, ").setFin(false));
send.add(new PingFrame().setPayload("ping"));
send.add(new ContinuationFrame().setPayload("world").setFin(true));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new PongFrame().setPayload("ping"));
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (Fuzzer fuzzer = new Fuzzer(this);
StacklessLogging supress = new StacklessLogging(Parser.class)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
}
}
use of org.eclipse.jetty.websocket.common.frames.PongFrame in project jetty.project by eclipse.
the class TestABCase2 method testCase2_1.
/**
* Ping without payload
* @throws Exception on test failure
*/
@Test
public void testCase2_1() throws Exception {
WebSocketFrame send = new PingFrame();
WebSocketFrame expect = new PongFrame();
try (Fuzzer fuzzer = new Fuzzer(this)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
}
}
use of org.eclipse.jetty.websocket.common.frames.PongFrame in project jetty.project by eclipse.
the class TestABCase2 method testCase2_3.
/**
* Ping with small binary (non-utf8) payload
* @throws Exception on test failure
*/
@Test
public void testCase2_3() throws Exception {
byte[] payload = new byte[] { 0x00, (byte) 0xFF, (byte) 0xFE, (byte) 0xFD, (byte) 0xFC, (byte) 0xFB, 0x00, (byte) 0xFF };
List<WebSocketFrame> send = new ArrayList<>();
send.add(new PingFrame().setPayload(payload));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new PongFrame().setPayload(copyOf(payload)));
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);
}
}
use of org.eclipse.jetty.websocket.common.frames.PongFrame in project jetty.project by eclipse.
the class TestABCase2 method testCase2_7.
/**
* Unsolicited pong frame without payload
* @throws Exception on test failure
*/
@Test
public void testCase2_7() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
// unsolicited pong
send.add(new PongFrame());
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);
}
}
use of org.eclipse.jetty.websocket.common.frames.PongFrame in project jetty.project by eclipse.
the class TestABCase2 method testCase2_8.
/**
* Unsolicited pong frame with basic payload
* @throws Exception on test failure
*/
@Test
public void testCase2_8() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
// unsolicited pong
send.add(new PongFrame().setPayload("unsolicited"));
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);
}
}
Aggregations