Examples of readFrames()


Examples of org.eclipse.jetty.websocket.common.test.BlockheadClient.readFrames()

            client.connect();
            client.sendStandardRequest();
            client.expectUpgradeResponse();

            client.write(new TextFrame().setPayload("getProtocols"));
            EventQueue<WebSocketFrame> frames = client.readFrames(1,1,TimeUnit.SECONDS);
            WebSocketFrame frame = frames.poll();
            Assert.assertThat("Frame Response", frame.getPayloadAsUTF8(), is("Requested Protocols: [\"echo\",\"chat\",\"status\"]"));
        }
    }
}
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.test.BlockheadClient.readFrames()

            byte buf[] = new byte[size]; // buffer bigger than maxMessageSize
            Arrays.fill(buf,(byte)'x');
            client.write(new TextFrame().setPayload(ByteBuffer.wrap(buf)));

            // Read frame (hopefully close frame saying its too large)
            EventQueue<WebSocketFrame> frames = client.readFrames(1,500,TimeUnit.MILLISECONDS);
            WebSocketFrame tf = frames.poll();
            Assert.assertThat("Frame is close", tf.getOpCode(), is(OpCode.CLOSE));
            CloseInfo close = new CloseInfo(tf);
            Assert.assertThat("Close Code", close.getStatusCode(), is(StatusCode.MESSAGE_TOO_LARGE));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.