Package org.eclipse.jetty.spdy

Examples of org.eclipse.jetty.spdy.StandardCompressionFactory


    public void testGenerateParse() throws Exception
    {
        int streamId = 13;
        int streamStatus = StreamStatus.UNSUPPORTED_VERSION.getCode(SPDY.V2);
        RstStreamFrame frame1 = new RstStreamFrame(SPDY.V2, streamId, streamStatus);
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.control(frame1);

        assertThat("buffer is not null", buffer, not(nullValue()));

        TestSPDYParserListener listener = new TestSPDYParserListener();
        Parser parser = new Parser(new StandardCompressionFactory().newDecompressor());
        parser.addListener(listener);
        parser.parse(buffer);
        ControlFrame frame2 = listener.getControlFrame();

        assertThat("frame2 is not null", frame2, not(nullValue()));
View Full Code Here


    public void testGenerateParseOneByteAtATime() throws Exception
    {
        int streamId = 13;
        int streamStatus = StreamStatus.UNSUPPORTED_VERSION.getCode(SPDY.V2);
        RstStreamFrame frame1 = new RstStreamFrame(SPDY.V2, streamId, streamStatus);
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.control(frame1);

        Assert.assertNotNull(buffer);

        TestSPDYParserListener listener = new TestSPDYParserListener();
        Parser parser = new Parser(new StandardCompressionFactory().newDecompressor());
        parser.addListener(listener);
        while (buffer.hasRemaining())
            parser.parse(ByteBuffer.wrap(new byte[]{buffer.get()}));
        ControlFrame frame2 = listener.getControlFrame();
View Full Code Here

        byte flags = SettingsInfo.CLEAR_PERSISTED;
        Settings settings = new Settings();
        settings.put(new Settings.Setting(Settings.ID.MAX_CONCURRENT_STREAMS, Settings.Flag.PERSIST, 100));
        settings.put(new Settings.Setting(Settings.ID.ROUND_TRIP_TIME, Settings.Flag.PERSISTED, 500));
        SettingsFrame frame1 = new SettingsFrame(SPDY.V2, flags, settings);
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.control(frame1);

        Assert.assertNotNull(buffer);

        TestSPDYParserListener listener = new TestSPDYParserListener();
        Parser parser = new Parser(new StandardCompressionFactory().newDecompressor());
        parser.addListener(listener);
        parser.parse(buffer);
        ControlFrame frame2 = listener.getControlFrame();

        Assert.assertNotNull(frame2);
View Full Code Here

        byte flags = SettingsInfo.CLEAR_PERSISTED;
        Settings settings = new Settings();
        settings.put(new Settings.Setting(Settings.ID.DOWNLOAD_RETRANSMISSION_RATE, 100));
        settings.put(new Settings.Setting(Settings.ID.ROUND_TRIP_TIME, 500));
        SettingsFrame frame1 = new SettingsFrame(SPDY.V2, flags, settings);
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.control(frame1);

        Assert.assertNotNull(buffer);

        TestSPDYParserListener listener = new TestSPDYParserListener();
        Parser parser = new Parser(new StandardCompressionFactory().newDecompressor());
        parser.addListener(listener);
        while (buffer.hasRemaining())
            parser.parse(ByteBuffer.wrap(new byte[]{buffer.get()}));
        ControlFrame frame2 = listener.getControlFrame();
View Full Code Here

    private void testGenerateParse(String content) throws Exception
    {
        int length = content.length();
        DataInfo data = new StringDataInfo(content, true);
        int streamId = 13;
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.data(streamId, 2 * length, data);

        Assert.assertNotNull(buffer);

        TestSPDYParserListener listener = new TestSPDYParserListener();
        Parser parser = new Parser(new StandardCompressionFactory().newDecompressor());
        parser.addListener(listener);
        parser.parse(buffer);
        DataFrame frame2 = listener.getDataFrame();

        Assert.assertNotNull(frame2);
View Full Code Here

    {
        String content = "test2";
        int length = content.length();
        DataInfo data = new StringDataInfo(content, true);
        int streamId = 13;
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.data(streamId, 2 * length, data);

        Assert.assertNotNull(buffer);

        TestSPDYParserListener listener = new TestSPDYParserListener();
        Parser parser = new Parser(new StandardCompressionFactory().newDecompressor());
        parser.addListener(listener);
        while (buffer.hasRemaining())
        {
            parser.parse(ByteBuffer.wrap(new byte[]{buffer.get()}));
            if (buffer.remaining() < length)
View Full Code Here

    {
        String content = "0123456789ABCDEF";
        int length = content.length();
        DataInfo data = new StringDataInfo(content, true);
        int streamId = 13;
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.data(streamId, 2 * length, data);

        Assert.assertNotNull(buffer);

        TestSPDYParserListener listener = new TestSPDYParserListener();
        Parser parser = new Parser(new StandardCompressionFactory().newDecompressor());
        parser.addListener(listener);

        // Split the buffer to simulate a split boundary in receiving the bytes
        int split = 3;
        ByteBuffer buffer1 = ByteBuffer.allocate(buffer.remaining() - split);
View Full Code Here

        byte flags = ReplyInfo.FLAG_CLOSE;
        int streamId = 13;
        Fields headers = new Fields();
        headers.put("a", "b");
        SynReplyFrame frame1 = new SynReplyFrame(SPDY.V2, flags, streamId, headers);
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.control(frame1);

        Assert.assertNotNull(buffer);

        TestSPDYParserListener listener = new TestSPDYParserListener();
        Parser parser = new Parser(new StandardCompressionFactory().newDecompressor());
        parser.addListener(listener);
        parser.parse(buffer);
        ControlFrame frame2 = listener.getControlFrame();

        Assert.assertNotNull(frame2);
View Full Code Here

        byte flags = ReplyInfo.FLAG_CLOSE;
        int streamId = 13;
        Fields headers = new Fields();
        headers.put("a", "b");
        SynReplyFrame frame1 = new SynReplyFrame(SPDY.V2, flags, streamId, headers);
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.control(frame1);

        Assert.assertNotNull(buffer);

        TestSPDYParserListener listener = new TestSPDYParserListener();
        Parser parser = new Parser(new StandardCompressionFactory().newDecompressor());
        parser.addListener(listener);
        while (buffer.hasRemaining())
            parser.parse(ByteBuffer.wrap(new byte[]{buffer.get()}));
        ControlFrame frame2 = listener.getControlFrame();
View Full Code Here

    }

    private ByteBuffer createHeadersFrameBuffer(Fields headers)
    {
        HeadersFrame frame1 = new HeadersFrame(SPDY.V2, flags, streamId, headers);
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory().newCompressor());
        ByteBuffer buffer = generator.control(frame1);
        assertThat("Buffer is not null", buffer, notNullValue());
        return buffer;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.spdy.StandardCompressionFactory

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.