Adding TestABCase9 with @Stress enabled

This commit is contained in:
Joakim Erdfelt 2012-08-06 13:55:55 -07:00
parent b8fc39a53e
commit 365f4d8448
7 changed files with 839 additions and 14 deletions

View File

@ -15,10 +15,14 @@ public class ABServlet extends WebSocketServlet
@Override
public void registerWebSockets(WebSocketServerFactory factory)
{
factory.register(ABSocket.class);
// Test cases 9.x uses BIG frame sizes, let policy handle them.
int bigFrameSize = 20 * MBYTE;
factory.getPolicy().setBufferSize(2 * MBYTE);
factory.getPolicy().setMaxTextMessageSize(2 * MBYTE);
factory.getPolicy().setMaxBinaryMessageSize(2 * MBYTE);
factory.getPolicy().setBufferSize(bigFrameSize);
factory.getPolicy().setMaxPayloadSize(bigFrameSize);
factory.getPolicy().setMaxTextMessageSize(bigFrameSize);
factory.getPolicy().setMaxBinaryMessageSize(bigFrameSize);
factory.register(ABSocket.class);
}
}

View File

@ -20,6 +20,15 @@ public class ABSocket
private WebSocketConnection conn;
private String abbreviate(String message)
{
if (message.length() > 80)
{
return '"' + message.substring(0,80) + "\"...";
}
return '"' + message + '"';
}
@OnWebSocketMessage
public void onBinary(byte buf[], int offset, int len)
{
@ -45,7 +54,17 @@ public class ABSocket
@OnWebSocketMessage
public void onText(String message)
{
LOG.debug("onText({})",message);
if (LOG.isDebugEnabled())
{
if (message == null)
{
LOG.debug("onText() msg=null");
}
else
{
LOG.debug("onText() size={}, msg={}",message.length(),abbreviate(message));
}
}
// echo the message back.
try

View File

@ -17,6 +17,7 @@ import org.junit.runners.Suite;
TestABCase7.class,
TestABCase7_GoodStatusCodes.class,
TestABCase7_BadStatusCodes.class,
TestABCase9.class
})
// @formatter:on
public class AllTests

View File

@ -12,6 +12,7 @@ import java.util.concurrent.TimeoutException;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.protocol.CloseInfo;
import org.eclipse.jetty.websocket.protocol.Generator;
import org.eclipse.jetty.websocket.protocol.OpCode;
@ -33,6 +34,9 @@ public class Fuzzer
SLOW
}
private static final int KBYTE = 1024;
private static final int MBYTE = KBYTE * KBYTE;
private static final Logger LOG = Log.getLogger(Fuzzer.class);
// Client side framing mask
@ -47,7 +51,16 @@ public class Fuzzer
public Fuzzer(AbstractABCase testcase) throws Exception
{
this.client = new BlockheadClient(testcase.getServer().getServerUri());
WebSocketPolicy policy = WebSocketPolicy.newClientPolicy();
int bigMessageSize = 20 * MBYTE;
policy.setBufferSize(bigMessageSize);
policy.setMaxPayloadSize(bigMessageSize);
policy.setMaxTextMessageSize(bigMessageSize);
policy.setMaxBinaryMessageSize(bigMessageSize);
this.client = new BlockheadClient(policy,testcase.getServer().getServerUri());
this.generator = testcase.getLaxGenerator();
this.testname = testcase.testname.getMethodName();
}
@ -88,11 +101,16 @@ public class Fuzzer
}
public void expect(List<WebSocketFrame> expect) throws IOException, TimeoutException
{
expect(expect,TimeUnit.MILLISECONDS,500);
}
public void expect(List<WebSocketFrame> expect, TimeUnit unit, int duration) throws IOException, TimeoutException
{
int expectedCount = expect.size();
// Read frames
IncomingFramesCapture capture = client.readFrames(expect.size(),TimeUnit.MILLISECONDS,500);
IncomingFramesCapture capture = client.readFrames(expect.size(),unit,duration);
if (LOG.isDebugEnabled())
{
capture.dump();

View File

@ -0,0 +1,777 @@
package org.eclipse.jetty.websocket.server.ab;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.toolchain.test.AdvancedRunner;
import org.eclipse.jetty.toolchain.test.annotation.Stress;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.protocol.CloseInfo;
import org.eclipse.jetty.websocket.protocol.OpCode;
import org.eclipse.jetty.websocket.protocol.WebSocketFrame;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Big frame/message tests
*/
@RunWith(AdvancedRunner.class)
public class TestABCase9 extends AbstractABCase
{
private static final int KBYTE = 1024;
private static final int MBYTE = KBYTE * KBYTE;
private void assertMultiFrameEcho(byte opcode, int overallMsgSize, int fragmentSize) throws Exception
{
byte msg[] = new byte[overallMsgSize];
Arrays.fill(msg,(byte)'M');
List<WebSocketFrame> send = new ArrayList<>();
byte frag[];
int remaining = msg.length;
int offset = 0;
boolean fin;
byte op = opcode;
while (remaining > 0)
{
int len = Math.min(remaining,fragmentSize);
frag = new byte[len];
System.arraycopy(msg,offset,frag,0,len);
remaining -= len;
fin = (remaining <= 0);
send.add(new WebSocketFrame(op).setPayload(frag).setFin(fin));
offset += len;
op = OpCode.CONTINUATION;
}
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new WebSocketFrame(opcode).setPayload(msg));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,8);
}
finally
{
fuzzer.close();
}
}
private void assertSlowFrameEcho(byte opcode, int overallMsgSize, int segmentSize) throws Exception
{
byte msg[] = new byte[overallMsgSize];
Arrays.fill(msg,(byte)'M');
List<WebSocketFrame> send = new ArrayList<>();
send.add(new WebSocketFrame(opcode).setPayload(msg));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new WebSocketFrame(opcode).setPayload(msg));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.SLOW);
fuzzer.setSlowSendSegmentSize(segmentSize);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,8);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 64KB text message (1 frame)
*/
@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(WebSocketFrame.text(msg));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.text(msg));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 256KB text message (1 frame)
*/
@Test
public void testCase9_1_2() throws Exception
{
byte utf[] = new byte[256 * KBYTE];
Arrays.fill(utf,(byte)'y');
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.text().setPayload(utf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.text().setPayload(utf));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,2);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 1MB text message (1 frame)
*/
@Test
@Stress("High I/O use")
public void testCase9_1_3() throws Exception
{
byte utf[] = new byte[1 * MBYTE];
Arrays.fill(utf,(byte)'y');
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.text().setPayload(utf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.text().setPayload(utf));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,4);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 4MB text message (1 frame)
*/
@Test
@Stress("High I/O use")
public void testCase9_1_4() throws Exception
{
byte utf[] = new byte[4 * MBYTE];
Arrays.fill(utf,(byte)'y');
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.text().setPayload(utf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.text().setPayload(utf));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,8);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 8MB text message (1 frame)
*/
@Test
@Stress("High I/O use")
public void testCase9_1_5() throws Exception
{
byte utf[] = new byte[8 * MBYTE];
Arrays.fill(utf,(byte)'y');
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.text().setPayload(utf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.text().setPayload(utf));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,16);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 16MB text message (1 frame)
*/
@Test
@Stress("High I/O use")
public void testCase9_1_6() throws Exception
{
byte utf[] = new byte[16 * MBYTE];
Arrays.fill(utf,(byte)'y');
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.text().setPayload(utf));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.text().setPayload(utf));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,32);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 64KB binary message (1 frame)
*/
@Test
public void testCase9_2_1() throws Exception
{
byte data[] = new byte[64 * KBYTE];
Arrays.fill(data,(byte)0x21);
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.binary(data));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.binary(data));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 256KB binary message (1 frame)
*/
@Test
public void testCase9_2_2() throws Exception
{
byte data[] = new byte[256 * KBYTE];
Arrays.fill(data,(byte)0x22);
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.binary().setPayload(data));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.binary().setPayload(data));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,2);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 1MB binary message (1 frame)
*/
@Test
@Stress("High I/O use")
public void testCase9_2_3() throws Exception
{
byte data[] = new byte[1 * MBYTE];
Arrays.fill(data,(byte)0x23);
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.binary().setPayload(data));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.binary().setPayload(data));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,4);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 4MB binary message (1 frame)
*/
@Test
@Stress("High I/O use")
public void testCase9_2_4() throws Exception
{
byte data[] = new byte[4 * MBYTE];
Arrays.fill(data,(byte)0x24);
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.binary().setPayload(data));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.binary().setPayload(data));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,8);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 8MB binary message (1 frame)
*/
@Test
@Stress("High I/O use")
public void testCase9_2_5() throws Exception
{
byte data[] = new byte[8 * MBYTE];
Arrays.fill(data,(byte)0x25);
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.binary().setPayload(data));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.binary().setPayload(data));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,16);
}
finally
{
fuzzer.close();
}
}
/**
* Echo 16MB binary message (1 frame)
*/
@Test
@Stress("High I/O use")
public void testCase9_2_6() throws Exception
{
byte data[] = new byte[16 * MBYTE];
Arrays.fill(data,(byte)0x26);
List<WebSocketFrame> send = new ArrayList<>();
send.add(WebSocketFrame.binary().setPayload(data));
send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(WebSocketFrame.binary().setPayload(data));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
Fuzzer fuzzer = new Fuzzer(this);
try
{
fuzzer.connect();
fuzzer.setSendMode(Fuzzer.SendMode.BULK);
fuzzer.send(send);
fuzzer.expect(expect,TimeUnit.SECONDS,32);
}
finally
{
fuzzer.close();
}
}
/**
* Send 4MB text message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_3_1() throws Exception
{
assertMultiFrameEcho(OpCode.TEXT,4 * MBYTE,64);
}
/**
* Send 4MB text message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_3_2() throws Exception
{
assertMultiFrameEcho(OpCode.TEXT,4 * MBYTE,256);
}
/**
* Send 4MB text message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_3_3() throws Exception
{
assertMultiFrameEcho(OpCode.TEXT,4 * MBYTE,1 * KBYTE);
}
/**
* Send 4MB text message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_3_4() throws Exception
{
assertMultiFrameEcho(OpCode.TEXT,4 * MBYTE,4 * KBYTE);
}
/**
* Send 4MB text message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_3_5() throws Exception
{
assertMultiFrameEcho(OpCode.TEXT,4 * MBYTE,16 * KBYTE);
}
/**
* Send 4MB text message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_3_6() throws Exception
{
assertMultiFrameEcho(OpCode.TEXT,4 * MBYTE,64 * KBYTE);
}
/**
* Send 4MB text message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_3_7() throws Exception
{
assertMultiFrameEcho(OpCode.TEXT,4 * MBYTE,256 * KBYTE);
}
/**
* Send 4MB text message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_3_8() throws Exception
{
assertMultiFrameEcho(OpCode.TEXT,4 * MBYTE,1 * MBYTE);
}
/**
* Send 4MB text message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_3_9() throws Exception
{
assertMultiFrameEcho(OpCode.TEXT,4 * MBYTE,4 * MBYTE);
}
/**
* Send 4MB binary message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_4_1() throws Exception
{
assertMultiFrameEcho(OpCode.BINARY,4 * MBYTE,64);
}
/**
* Send 4MB binary message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_4_2() throws Exception
{
assertMultiFrameEcho(OpCode.BINARY,4 * MBYTE,256);
}
/**
* Send 4MB binary message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_4_3() throws Exception
{
assertMultiFrameEcho(OpCode.BINARY,4 * MBYTE,1 * KBYTE);
}
/**
* Send 4MB binary message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_4_4() throws Exception
{
assertMultiFrameEcho(OpCode.BINARY,4 * MBYTE,4 * KBYTE);
}
/**
* Send 4MB binary message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_4_5() throws Exception
{
assertMultiFrameEcho(OpCode.BINARY,4 * MBYTE,16 * KBYTE);
}
/**
* Send 4MB binary message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_4_6() throws Exception
{
assertMultiFrameEcho(OpCode.BINARY,4 * MBYTE,64 * KBYTE);
}
/**
* Send 4MB binary message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_4_7() throws Exception
{
assertMultiFrameEcho(OpCode.BINARY,4 * MBYTE,256 * KBYTE);
}
/**
* Send 4MB binary message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_4_8() throws Exception
{
assertMultiFrameEcho(OpCode.BINARY,4 * MBYTE,1 * MBYTE);
}
/**
* Send 4MB binary message in multiple frames.
*/
@Test
@Stress("High I/O use")
public void testCase9_4_9() throws Exception
{
assertMultiFrameEcho(OpCode.BINARY,4 * MBYTE,4 * MBYTE);
}
/**
* Send 1MB text message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_5_1() throws Exception
{
assertSlowFrameEcho(OpCode.TEXT,1 * MBYTE,64);
}
/**
* Send 1MB text message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_5_2() throws Exception
{
assertSlowFrameEcho(OpCode.TEXT,1 * MBYTE,128);
}
/**
* Send 1MB text message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_5_3() throws Exception
{
assertSlowFrameEcho(OpCode.TEXT,1 * MBYTE,256);
}
/**
* Send 1MB text message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_5_4() throws Exception
{
assertSlowFrameEcho(OpCode.TEXT,1 * MBYTE,512);
}
/**
* Send 1MB text message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_5_5() throws Exception
{
assertSlowFrameEcho(OpCode.TEXT,1 * MBYTE,1024);
}
/**
* Send 1MB text message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_5_6() throws Exception
{
assertSlowFrameEcho(OpCode.TEXT,1 * MBYTE,2048);
}
/**
* Send 1MB binary message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_6_1() throws Exception
{
assertSlowFrameEcho(OpCode.BINARY,1 * MBYTE,64);
}
/**
* Send 1MB binary message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_6_2() throws Exception
{
assertSlowFrameEcho(OpCode.BINARY,1 * MBYTE,128);
}
/**
* Send 1MB binary message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_6_3() throws Exception
{
assertSlowFrameEcho(OpCode.BINARY,1 * MBYTE,256);
}
/**
* Send 1MB binary message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_6_4() throws Exception
{
assertSlowFrameEcho(OpCode.BINARY,1 * MBYTE,512);
}
/**
* Send 1MB binary message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_6_5() throws Exception
{
assertSlowFrameEcho(OpCode.BINARY,1 * MBYTE,1024);
}
/**
* Send 1MB binary message in 1 frame, but slowly
*/
@Test
@Stress("High I/O use")
public void testCase9_6_6() throws Exception
{
assertSlowFrameEcho(OpCode.BINARY,1 * MBYTE,2048);
}
}

View File

@ -106,6 +106,11 @@ public class BlockheadClient implements IncomingFrames, OutgoingFrames
private OutgoingFrames outgoing = this;
public BlockheadClient(URI destWebsocketURI) throws URISyntaxException
{
this(WebSocketPolicy.newClientPolicy(),destWebsocketURI);
}
public BlockheadClient(WebSocketPolicy policy, URI destWebsocketURI) throws URISyntaxException
{
Assert.assertThat("Websocket URI scheme",destWebsocketURI.getScheme(),anyOf(is("ws"),is("wss")));
this.destWebsocketURI = destWebsocketURI;
@ -116,15 +121,15 @@ public class BlockheadClient implements IncomingFrames, OutgoingFrames
}
this.destHttpURI = new URI(scheme,destWebsocketURI.getSchemeSpecificPart(),destWebsocketURI.getFragment());
policy = WebSocketPolicy.newClientPolicy();
bufferPool = new StandardByteBufferPool(policy.getBufferSize());
generator = new Generator(policy,bufferPool);
parser = new Parser(policy);
parseCount = new AtomicInteger(0);
this.policy = policy;
this.bufferPool = new StandardByteBufferPool(policy.getBufferSize());
this.generator = new Generator(policy,bufferPool);
this.parser = new Parser(policy);
this.parseCount = new AtomicInteger(0);
incomingFrames = new IncomingFramesCapture();
this.incomingFrames = new IncomingFramesCapture();
extensionRegistry = new WebSocketExtensionRegistry(policy,bufferPool);
this.extensionRegistry = new WebSocketExtensionRegistry(policy,bufferPool);
}
public void addExtensions(String xtension)

View File

@ -18,4 +18,5 @@ org.eclipse.jetty.websocket.server.helper.RFCSocket.LEVEL=OFF
# org.eclipse.jetty.websocket.protocol.Generator.LEVEL=INFO
# org.eclipse.jetty.websocket.protocol.Parser.LEVEL=DEBUG
# org.eclipse.jetty.websocket.server.ab.LEVEL=DEBUG
# org.eclipse.jetty.websocket.server.ab.Fuzzer.LEVEL=DEBUG
# org.eclipse.jetty.websocket.server.blockhead.LEVEL=DEBUG