update to use latest changes on frame

This commit is contained in:
Jesse McConnell 2012-07-10 13:52:27 -05:00
parent d6139b8978
commit 8c6820a812
3 changed files with 19 additions and 21 deletions

View File

@ -35,16 +35,16 @@ public class WebSocketFrame implements Frame
/** Maximum size of Control frame, per RFC 6455 */
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()
{
return new WebSocketFrame(OpCode.BINARY);
}
public static WebSocketFrame binary(byte buf[])
{
return new WebSocketFrame(OpCode.BINARY).setPayload(buf);
}
public static WebSocketFrame text()
{
return new WebSocketFrame(OpCode.TEXT);

View File

@ -10,7 +10,6 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.generator.Generator;
import org.eclipse.jetty.websocket.parser.FrameParseCapture;
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.WebSocketFrame;
import org.junit.Assert;
@ -35,7 +34,7 @@ public class TestABCase1_1
builder.append("*");
}
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(textFrame);
@ -73,7 +72,7 @@ public class TestABCase1_1
builder.append("*");
}
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(textFrame);
@ -115,7 +114,7 @@ public class TestABCase1_1
builder.append("*");
}
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(textFrame);
@ -157,7 +156,7 @@ public class TestABCase1_1
builder.append("*");
}
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(textFrame);
@ -199,7 +198,7 @@ public class TestABCase1_1
builder.append("*");
}
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(textFrame);
@ -239,7 +238,7 @@ public class TestABCase1_1
builder.append("*");
}
WebSocketFrame textFrame = FrameBuilder.text(builder.toString()).asFrame();
WebSocketFrame textFrame = WebSocketFrame.text(builder.toString());
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(textFrame);
@ -270,7 +269,7 @@ public class TestABCase1_1
@Test
public void testGenerateEmptyTextCase1_1_1()
{
WebSocketFrame textFrame = FrameBuilder.text("").asFrame();
WebSocketFrame textFrame = WebSocketFrame.text("");
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(textFrame);

View File

@ -11,7 +11,6 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.generator.Generator;
import org.eclipse.jetty.websocket.parser.FrameParseCapture;
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.WebSocketFrame;
import org.junit.Assert;
@ -38,7 +37,7 @@ public class TestABCase1_2
bb.flip();
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(binaryFrame);
@ -79,7 +78,7 @@ public class TestABCase1_2
bb.flip();
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(binaryFrame);
@ -124,7 +123,7 @@ public class TestABCase1_2
bb.flip();
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(binaryFrame);
@ -168,7 +167,7 @@ public class TestABCase1_2
}
bb.flip();
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(binaryFrame);
@ -213,7 +212,7 @@ public class TestABCase1_2
bb.flip();
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(binaryFrame);
@ -255,7 +254,7 @@ public class TestABCase1_2
bb.flip();
WebSocketFrame binaryFrame = FrameBuilder.binary(BufferUtil.toArray(bb)).asFrame();
WebSocketFrame binaryFrame = WebSocketFrame.binary(BufferUtil.toArray(bb));
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(binaryFrame);
@ -286,7 +285,7 @@ public class TestABCase1_2
@Test
public void testGenerateEmptyBinaryCase1_2_1()
{
WebSocketFrame binaryFrame = FrameBuilder.binary(new byte[] {}).asFrame();
WebSocketFrame binaryFrame = WebSocketFrame.binary(new byte[] {});
Generator generator = new Generator(policy);
ByteBuffer actual = generator.generate(binaryFrame);