Fixing policy

This commit is contained in:
Joakim Erdfelt 2012-07-06 14:05:58 -07:00
parent 2f3937687d
commit f1be381866
2 changed files with 5 additions and 3 deletions

View File

@ -92,9 +92,9 @@ public class WebSocketPolicy
public void assertValidPayloadLength(int payloadLength)
{
// validate to buffer sizes
if (payloadLength > payloadLength)
if (payloadLength > maxPayloadSize)
{
throw new MessageTooLargeException("Requested payload length [" + payloadLength + "] exceeds maximum size [" + payloadLength + "]");
throw new MessageTooLargeException("Requested payload length [" + payloadLength + "] exceeds maximum size [" + maxPayloadSize + "]");
}
}

View File

@ -21,7 +21,9 @@ public class TextPayloadParserTest
public void testFrameTooLargeDueToPolicy() throws Exception
{
WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.SERVER);
policy.setBufferSize(1024); // set policy to something TEENY
// Artificially small buffer/payload
policy.setBufferSize(512);
policy.setMaxPayloadSize(1024);
byte utf[] = new byte[2048];
Arrays.fill(utf,(byte)'a');