use of org.eclipse.jetty.websocket.common.frames.TextFrame in project jetty.project by eclipse.
the class TestABCase7 method testCase7_1_5.
/**
* Text fin=false, close, then continuation fin=true
* @throws Exception on test failure
*/
@Test
public void testCase7_1_5() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload("an").setFin(false));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
send.add(new ContinuationFrame().setPayload("ticipation").setFin(true));
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.frames.TextFrame in project jetty.project by eclipse.
the class TestABCase7 method testCase7_1_6.
/**
* 256k msg, then close, then ping
* @throws Exception on test failure
*/
@Test
public void testCase7_1_6() throws Exception {
byte[] msg = new byte[256 * 1024];
Arrays.fill(msg, (byte) '*');
ByteBuffer buf = ByteBuffer.wrap(msg);
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload(buf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
send.add(new PingFrame().setPayload("out of band"));
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new TextFrame().setPayload(clone(buf)));
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.frames.TextFrame in project jetty.project by eclipse.
the class TestABCase7 method testCase7_1_4.
/**
* Close frame, then ping frame (no pong received)
* @throws Exception on test failure
*/
@Test
public void testCase7_1_4() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
send.add(new TextFrame().setPayload("out of band text"));
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.frames.TextFrame in project jetty.project by eclipse.
the class TestABCase9 method testCase9_1_1.
/**
* Echo 64KB text message (1 frame)
* @throws Exception on test failure
*/
@Test
public void testCase9_1_1() throws Exception {
byte[] utf = new byte[64 * KBYTE];
Arrays.fill(utf, (byte) 'y');
String msg = StringUtil.toUTF8String(utf, 0, utf.length);
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload(msg));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new TextFrame().setPayload(msg));
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.TextFrame in project jetty.project by eclipse.
the class TestABCase5 method testCase5_5.
/**
* Send text fragmented in 2 packets (slowly)
* @throws Exception on test failure
*/
@Test
public void testCase5_5() throws Exception {
List<WebSocketFrame> send = new ArrayList<>();
send.add(new TextFrame().setPayload("hello, ").setFin(false));
send.add(new ContinuationFrame().setPayload("world").setFin(true));
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);
StacklessLogging supress = new StacklessLogging(Parser.class)) {
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.SLOW);
fuzzer.setSlowSendSegmentSize(1);
fuzzer.send(send);
fuzzer.expect(expect);
}
}
Aggregations