* Verify that incoming frames are passed thru without modification
*/
@Test
public void testIncomingFrames()
{
IncomingFramesCapture capture = new IncomingFramesCapture();
FragmentExtension ext = new FragmentExtension();
ext.setBufferPool(bufferPool);
ext.setPolicy(WebSocketPolicy.newClientPolicy());
ExtensionConfig config = ExtensionConfig.parse("fragment;maxLength=4");
ext.setConfig(config);
ext.setNextIncomingFrames(capture);
// Quote
List<String> quote = new ArrayList<>();
quote.add("No amount of experimentation can ever prove me right;");
quote.add("a single experiment can prove me wrong.");
quote.add("-- Albert Einstein");
// Manually create frame and pass into extension
for (String q : quote)
{
Frame frame = new TextFrame().setPayload(q);
ext.incomingFrame(frame);
}
int len = quote.size();
capture.assertFrameCount(len);
capture.assertHasFrame(OpCode.TEXT, len);
String prefix;
int i = 0;
for (WebSocketFrame actual : capture.getFrames())
{
prefix = "Frame[" + i + "]";
Assert.assertThat(prefix + ".opcode", actual.getOpCode(), is(OpCode.TEXT));
Assert.assertThat(prefix + ".fin", actual.isFin(), is(true));