use of org.eclipse.jetty.websocket.common.frames.BinaryFrame in project jetty.project by eclipse.
the class TestABCase9 method testCase9_2_3.
/**
* Echo 1MB binary message (1 frame)
* @throws Exception on test failure
*/
@Test
@Stress("High I/O use")
public void testCase9_2_3() throws Exception {
byte[] data = new byte[1 * MBYTE];
Arrays.fill(data, (byte) 0x23);
ByteBuffer buf = ByteBuffer.wrap(data);
List<WebSocketFrame> send = new ArrayList<>();
send.add(new BinaryFrame().setPayload(buf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new BinaryFrame().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, 4, TimeUnit.SECONDS);
}
}
use of org.eclipse.jetty.websocket.common.frames.BinaryFrame in project jetty.project by eclipse.
the class TestABCase9 method testCase9_2_5.
/**
* Echo 8MB binary message (1 frame)
* @throws Exception on test failure
*/
@Test
@Stress("High I/O use")
public void testCase9_2_5() throws Exception {
byte[] data = new byte[8 * MBYTE];
Arrays.fill(data, (byte) 0x25);
ByteBuffer buf = ByteBuffer.wrap(data);
List<WebSocketFrame> send = new ArrayList<>();
send.add(new BinaryFrame().setPayload(buf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new BinaryFrame().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, 16, TimeUnit.SECONDS);
}
}
use of org.eclipse.jetty.websocket.common.frames.BinaryFrame in project jetty.project by eclipse.
the class TestABCase9 method testCase9_2_6.
/**
* Echo 16MB binary message (1 frame)
* @throws Exception on test failure
*/
@Test
@Stress("High I/O use")
public void testCase9_2_6() throws Exception {
byte[] data = new byte[16 * MBYTE];
Arrays.fill(data, (byte) 0x26);
ByteBuffer buf = ByteBuffer.wrap(data);
List<WebSocketFrame> send = new ArrayList<>();
send.add(new BinaryFrame().setPayload(buf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new BinaryFrame().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, 32, TimeUnit.SECONDS);
}
}
use of org.eclipse.jetty.websocket.common.frames.BinaryFrame in project jetty.project by eclipse.
the class TestABCase9 method testCase9_2_2.
/**
* Echo 256KB binary message (1 frame)
* @throws Exception on test failure
*/
@Test
public void testCase9_2_2() throws Exception {
byte[] data = new byte[256 * KBYTE];
Arrays.fill(data, (byte) 0x22);
ByteBuffer buf = ByteBuffer.wrap(data);
List<WebSocketFrame> send = new ArrayList<>();
send.add(new BinaryFrame().setPayload(buf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new BinaryFrame().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);
}
}
use of org.eclipse.jetty.websocket.common.frames.BinaryFrame in project jetty.project by eclipse.
the class TestABCase9 method testCase9_2_4.
/**
* Echo 4MB binary message (1 frame)
* @throws Exception on test failure
*/
@Test
@Stress("High I/O use")
public void testCase9_2_4() throws Exception {
byte[] data = new byte[4 * MBYTE];
Arrays.fill(data, (byte) 0x24);
ByteBuffer buf = ByteBuffer.wrap(data);
List<WebSocketFrame> send = new ArrayList<>();
send.add(new BinaryFrame().setPayload(buf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new BinaryFrame().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, 8, TimeUnit.SECONDS);
}
}
Aggregations