Code cleanups.

This commit is contained in:
Simone Bordet 2016-06-14 11:04:01 +02:00
parent c0f54ab82f
commit fb76491ea0
1 changed files with 9 additions and 9 deletions

View File

@ -57,7 +57,7 @@ public class PerMessageDeflateExtensionTest
MEDIUM(10*1024),
LARGE(100*1024),
HUGE(1024*1024);
private int size;
private TestCaseMessageSize(int size)
@ -65,12 +65,12 @@ public class PerMessageDeflateExtensionTest
this.size = size;
}
}
@Parameters(name = "{0} ({3}) (Input Buffer Size: {4} bytes)")
public static List<Object[]> modes()
{
List<Object[]> modes = new ArrayList<>();
for(TestCaseMessageSize size: TestCaseMessageSize.values())
{
modes.add(new Object[] { "Normal HTTP/WS", false, "ws", size, -1 });
@ -79,7 +79,7 @@ public class PerMessageDeflateExtensionTest
modes.add(new Object[] { "Normal HTTP/WS", false, "ws", size, altInputBufSize });
modes.add(new Object[] { "Encrypted HTTPS/WSS", true, "wss", size, altInputBufSize });
}
return modes;
}
@ -121,9 +121,9 @@ public class PerMessageDeflateExtensionTest
Assert.assertThat("server scheme",server.getServerUri().getScheme(),is(scheme));
int binBufferSize = (int) (msgSize * 1.5);
WebSocketPolicy serverPolicy = server.getWebSocketServletFactory().getPolicy();
// Ensure binBufferSize is sane (not smaller then other buffers)
binBufferSize = Math.max(binBufferSize,serverPolicy.getMaxBinaryMessageSize());
binBufferSize = Math.max(binBufferSize,serverPolicy.getMaxBinaryMessageBufferSize());
@ -140,7 +140,7 @@ public class PerMessageDeflateExtensionTest
{
clientPolicy.setInputBufferSize(inputBufferSize);
}
try
{
client.start();
@ -164,10 +164,10 @@ public class PerMessageDeflateExtensionTest
Random rand = new Random();
rand.setSeed(8080);
rand.nextBytes(msg);
// Calculate sha1
String sha1 = Sha1Sum.calculate(msg);
// Client sends first message
session.getRemote().sendBytes(ByteBuffer.wrap(msg));