update to use latest changes on frame
This commit is contained in:
parent
d6139b8978
commit
8c6820a812
|
@ -35,16 +35,16 @@ public class WebSocketFrame implements Frame
|
||||||
/** Maximum size of Control frame, per RFC 6455 */
|
/** Maximum size of Control frame, per RFC 6455 */
|
||||||
public static final int MAX_CONTROL_PAYLOAD = 125;
|
public static final int MAX_CONTROL_PAYLOAD = 125;
|
||||||
|
|
||||||
public static WebSocketFrame binar(byte buf[])
|
|
||||||
{
|
|
||||||
return new WebSocketFrame(OpCode.BINARY).setPayload(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WebSocketFrame binary()
|
public static WebSocketFrame binary()
|
||||||
{
|
{
|
||||||
return new WebSocketFrame(OpCode.BINARY);
|
return new WebSocketFrame(OpCode.BINARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static WebSocketFrame binary(byte buf[])
|
||||||
|
{
|
||||||
|
return new WebSocketFrame(OpCode.BINARY).setPayload(buf);
|
||||||
|
}
|
||||||
|
|
||||||
public static WebSocketFrame text()
|
public static WebSocketFrame text()
|
||||||
{
|
{
|
||||||
return new WebSocketFrame(OpCode.TEXT);
|
return new WebSocketFrame(OpCode.TEXT);
|
||||||
|
|
|
@ -10,7 +10,6 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
||||||
import org.eclipse.jetty.websocket.generator.Generator;
|
import org.eclipse.jetty.websocket.generator.Generator;
|
||||||
import org.eclipse.jetty.websocket.parser.FrameParseCapture;
|
import org.eclipse.jetty.websocket.parser.FrameParseCapture;
|
||||||
import org.eclipse.jetty.websocket.parser.Parser;
|
import org.eclipse.jetty.websocket.parser.Parser;
|
||||||
import org.eclipse.jetty.websocket.protocol.FrameBuilder;
|
|
||||||
import org.eclipse.jetty.websocket.protocol.OpCode;
|
import org.eclipse.jetty.websocket.protocol.OpCode;
|
||||||
import org.eclipse.jetty.websocket.protocol.WebSocketFrame;
|
import org.eclipse.jetty.websocket.protocol.WebSocketFrame;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -35,7 +34,7 @@ public class TestABCase1_1
|
||||||
builder.append("*");
|
builder.append("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
|
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(textFrame);
|
ByteBuffer actual = generator.generate(textFrame);
|
||||||
|
@ -73,7 +72,7 @@ public class TestABCase1_1
|
||||||
builder.append("*");
|
builder.append("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
|
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(textFrame);
|
ByteBuffer actual = generator.generate(textFrame);
|
||||||
|
@ -115,7 +114,7 @@ public class TestABCase1_1
|
||||||
builder.append("*");
|
builder.append("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
|
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(textFrame);
|
ByteBuffer actual = generator.generate(textFrame);
|
||||||
|
@ -157,7 +156,7 @@ public class TestABCase1_1
|
||||||
builder.append("*");
|
builder.append("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
|
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(textFrame);
|
ByteBuffer actual = generator.generate(textFrame);
|
||||||
|
@ -199,7 +198,7 @@ public class TestABCase1_1
|
||||||
builder.append("*");
|
builder.append("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
|
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(textFrame);
|
ByteBuffer actual = generator.generate(textFrame);
|
||||||
|
@ -239,7 +238,7 @@ public class TestABCase1_1
|
||||||
builder.append("*");
|
builder.append("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
|
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(textFrame);
|
ByteBuffer actual = generator.generate(textFrame);
|
||||||
|
@ -270,7 +269,7 @@ public class TestABCase1_1
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateEmptyTextCase1_1_1()
|
public void testGenerateEmptyTextCase1_1_1()
|
||||||
{
|
{
|
||||||
WebSocketFrame textFrame = FrameBuilder.text("").asFrame();
|
WebSocketFrame textFrame = WebSocketFrame.text("");
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(textFrame);
|
ByteBuffer actual = generator.generate(textFrame);
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
||||||
import org.eclipse.jetty.websocket.generator.Generator;
|
import org.eclipse.jetty.websocket.generator.Generator;
|
||||||
import org.eclipse.jetty.websocket.parser.FrameParseCapture;
|
import org.eclipse.jetty.websocket.parser.FrameParseCapture;
|
||||||
import org.eclipse.jetty.websocket.parser.Parser;
|
import org.eclipse.jetty.websocket.parser.Parser;
|
||||||
import org.eclipse.jetty.websocket.protocol.FrameBuilder;
|
|
||||||
import org.eclipse.jetty.websocket.protocol.OpCode;
|
import org.eclipse.jetty.websocket.protocol.OpCode;
|
||||||
import org.eclipse.jetty.websocket.protocol.WebSocketFrame;
|
import org.eclipse.jetty.websocket.protocol.WebSocketFrame;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -38,7 +37,7 @@ public class TestABCase1_2
|
||||||
|
|
||||||
bb.flip();
|
bb.flip();
|
||||||
|
|
||||||
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
|
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(binaryFrame);
|
ByteBuffer actual = generator.generate(binaryFrame);
|
||||||
|
@ -79,7 +78,7 @@ public class TestABCase1_2
|
||||||
|
|
||||||
bb.flip();
|
bb.flip();
|
||||||
|
|
||||||
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
|
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(binaryFrame);
|
ByteBuffer actual = generator.generate(binaryFrame);
|
||||||
|
@ -124,7 +123,7 @@ public class TestABCase1_2
|
||||||
|
|
||||||
bb.flip();
|
bb.flip();
|
||||||
|
|
||||||
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
|
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(binaryFrame);
|
ByteBuffer actual = generator.generate(binaryFrame);
|
||||||
|
@ -168,7 +167,7 @@ public class TestABCase1_2
|
||||||
}
|
}
|
||||||
|
|
||||||
bb.flip();
|
bb.flip();
|
||||||
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
|
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(binaryFrame);
|
ByteBuffer actual = generator.generate(binaryFrame);
|
||||||
|
@ -213,7 +212,7 @@ public class TestABCase1_2
|
||||||
|
|
||||||
bb.flip();
|
bb.flip();
|
||||||
|
|
||||||
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
|
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(binaryFrame);
|
ByteBuffer actual = generator.generate(binaryFrame);
|
||||||
|
@ -255,7 +254,7 @@ public class TestABCase1_2
|
||||||
|
|
||||||
bb.flip();
|
bb.flip();
|
||||||
|
|
||||||
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
|
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(binaryFrame);
|
ByteBuffer actual = generator.generate(binaryFrame);
|
||||||
|
@ -286,7 +285,7 @@ public class TestABCase1_2
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateEmptyBinaryCase1_2_1()
|
public void testGenerateEmptyBinaryCase1_2_1()
|
||||||
{
|
{
|
||||||
WebSocketFrame binaryFrame = FrameBuilder.binary(new byte[] {}).asFrame();
|
WebSocketFrame binaryFrame = WebSocketFrame.binary(new byte[] {});
|
||||||
|
|
||||||
Generator generator = new Generator(policy);
|
Generator generator = new Generator(policy);
|
||||||
ByteBuffer actual = generator.generate(binaryFrame);
|
ByteBuffer actual = generator.generate(binaryFrame);
|
||||||
|
|
Loading…
Reference in New Issue