Package org.eclipse.jetty.spdy.api

Examples of org.eclipse.jetty.spdy.api.StringDataInfo


            public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
            {
                Assert.assertTrue(stream.isHalfClosed());

                stream.reply(new ReplyInfo(false), new Callback.Adapter());
                stream.data(new StringDataInfo(data, true), new Callback.Adapter());

                return null;
            }
        };
View Full Code Here


                rstLatch.countDown();
            }
        });

        Stream stream = session.syn(new SynInfo(5, TimeUnit.SECONDS, new Fields(), false, (byte)0), null);
        stream.data(new StringDataInfo(5, TimeUnit.SECONDS, "data", true), new Callback.Adapter()
        {
            @Override
            public void succeeded()
            {
                synLatch.countDown();
View Full Code Here

            }
        });

        Stream stream = session.syn(new SynInfo(5, TimeUnit.SECONDS, new Fields(), false, (byte)0), null);
        assertThat("push is received by server", synLatch.await(5, TimeUnit.SECONDS), is(true));
        stream.data(new StringDataInfo(5, TimeUnit.SECONDS, "data", false), new Callback.Adapter());
        assertThat("stream is reset", rstLatch.await(5, TimeUnit.SECONDS), is(true));
        stream.data(new StringDataInfo(5, TimeUnit.SECONDS, "2nd dataframe", false), new Callback.Adapter()
        {
            @Override
            public void failed(Throwable x)
            {
                failLatch.countDown();
View Full Code Here

        IStream stream = createStream();
        IStream pushStream = createPushStream(stream);
        assertThatPushStreamIsHalfClosed(pushStream);
        assertThatPushStreamIsInSession(pushStream);
        assertThatStreamIsAssociatedWithPushStream(stream, pushStream);
        session.data(pushStream, new StringDataInfo("close", true), 5, TimeUnit.SECONDS, new Callback.Adapter());
        assertThatPushStreamIsClosed(pushStream);
        assertThatPushStreamIsNotInSession(pushStream);
        assertThatStreamIsNotAssociatedWithPushStream(stream, pushStream);
    }
View Full Code Here

        final CountDownLatch closedListenerCalledLatch = new CountDownLatch(1);
        session.addListener(new TestStreamListener(createdListenerCalledLatch, closedListenerCalledLatch));
        IStream stream = createStream();
        session.onControlFrame(new SynReplyFrame(VERSION, (byte)0, stream.getId(), new Fields()));
        session.onDataFrame(new DataFrame(stream.getId(), SynInfo.FLAG_CLOSE, 128), ByteBuffer.allocate(128));
        stream.data(new StringDataInfo("close", true));
        assertThat("onStreamCreated listener has been called", createdListenerCalledLatch.await(5, TimeUnit.SECONDS), is(true));
        assertThatOnStreamClosedListenerHasBeenCalled(closedListenerCalledLatch);
    }
View Full Code Here

        final CountDownLatch createdListenerCalledLatch = new CountDownLatch(2);
        final CountDownLatch closedListenerCalledLatch = new CountDownLatch(1);
        session.addListener(new TestStreamListener(createdListenerCalledLatch, closedListenerCalledLatch));
        IStream stream = createStream();
        IStream pushStream = createPushStream(stream);
        session.data(pushStream, new StringDataInfo("close", true), 5, TimeUnit.SECONDS, new Callback.Adapter());
        assertThat("onStreamCreated listener has been called twice. Once for the stream and once for the pushStream",
                createdListenerCalledLatch.await(5, TimeUnit.SECONDS), is(true));
        assertThatOnStreamClosedListenerHasBeenCalled(closedListenerCalledLatch);
    }
View Full Code Here

            {
                failedCalledLatch.countDown();
            }
        };
        // Data frame should fail on controller.write()
        stream.data(new StringDataInfo(5, TimeUnit.SECONDS, "data", false), callback);

        Assert.assertEquals(2, writes.get());
        Assert.assertTrue(failedCalledLatch.await(5, TimeUnit.SECONDS));
    }
View Full Code Here

        IStream stream = new StandardStream(synStreamFrame.getStreamId(), synStreamFrame.getPriority(), session,
                null, scheduler, null);
        stream.updateWindowSize(8192);
        stream.updateCloseState(synStreamFrame.isClose(), true);
        assertThat("stream is half closed", stream.isHalfClosed(), is(true));
        stream.data(new StringDataInfo("data on half closed stream", true));
        verify(session, never()).data(any(IStream.class), any(DataInfo.class), anyInt(), any(TimeUnit.class), any(Callback.class));
    }
View Full Code Here

                assertThat("exception is a TimeoutException", x, is(instanceOf(TimeoutException.class)));
                failureCount.incrementAndGet();
                failureLatch.countDown();
            }
        });
        stream.process(new StringDataInfo("string", false));

        // Wait more than (2 * idleTimeout) to be sure to trigger a failureCount > 1
        Thread.sleep(3 * idleTimeout);

        assertThat("onFailure has been called", failureLatch.await(5, TimeUnit.SECONDS), is(true));
View Full Code Here

                assertThat("exception is a TimeoutException", x, is(instanceOf(TimeoutException.class)));
                failureLatch.countDown();
            }
        });
        stream.process(new SynStreamFrame(SPDY.V3, (byte)0, 1, 0, (byte)0, (short)0, null));
        stream.process(new StringDataInfo("string", false));
        Thread.sleep(idleTimeout / 2);
        stream.process(new StringDataInfo("string", false));
        Thread.sleep(idleTimeout / 2);
        stream.process(new StringDataInfo("string", false));
        Thread.sleep(idleTimeout / 2);
        stream.process(new StringDataInfo("string", true));
        stream.reply(new ReplyInfo(true), new Callback.Adapter());
        Thread.sleep(idleTimeout);
        assertThat("onFailure has not been called", failureLatch.await(idleTimeout, TimeUnit.MILLISECONDS), is(false));
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.spdy.api.StringDataInfo

Copyright © 2018 www.massapicom. 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.