Search in sources :

Example 6 with Stress

use of org.eclipse.jetty.toolchain.test.annotation.Stress 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);
    }
}
Also used : Fuzzer(org.eclipse.jetty.websocket.common.test.Fuzzer) BinaryFrame(org.eclipse.jetty.websocket.common.frames.BinaryFrame) ArrayList(java.util.ArrayList) WebSocketFrame(org.eclipse.jetty.websocket.common.WebSocketFrame) ByteBuffer(java.nio.ByteBuffer) CloseInfo(org.eclipse.jetty.websocket.common.CloseInfo) Test(org.junit.Test) Stress(org.eclipse.jetty.toolchain.test.annotation.Stress)

Aggregations

ByteBuffer (java.nio.ByteBuffer)6 ArrayList (java.util.ArrayList)6 Stress (org.eclipse.jetty.toolchain.test.annotation.Stress)6 CloseInfo (org.eclipse.jetty.websocket.common.CloseInfo)6 WebSocketFrame (org.eclipse.jetty.websocket.common.WebSocketFrame)6 Fuzzer (org.eclipse.jetty.websocket.common.test.Fuzzer)6 Test (org.junit.Test)6 BinaryFrame (org.eclipse.jetty.websocket.common.frames.BinaryFrame)4 TextFrame (org.eclipse.jetty.websocket.common.frames.TextFrame)2