Examples of MappedByteBufferPool


Examples of org.eclipse.jetty.io.MappedByteBufferPool

        ByteBuffer readBuffer = ByteBuffer.allocate(1024);
        channel.read(readBuffer);
        readBuffer.flip();
        int streamId = readBuffer.getInt(8);

        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory.StandardCompressor());
        byte[] bytes = new byte[1];
        ByteBuffer writeBuffer = generator.data(streamId, bytes.length, new BytesDataInfo(bytes, true));
        channel.write(writeBuffer);
        assertThat("data is fully written", writeBuffer.hasRemaining(),is(false));
View Full Code Here

Examples of org.eclipse.jetty.io.MappedByteBufferPool

        ByteBuffer readBuffer = ByteBuffer.allocate(1024);
        channel.read(readBuffer);
        readBuffer.flip();
        int streamId = readBuffer.getInt(8);

        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory.StandardCompressor());

        ByteBuffer writeBuffer = generator.control(new SynReplyFrame(SPDY.V2, (byte)0, streamId, new Fields()));
        channel.write(writeBuffer);
        assertThat("SynReply is fully written", writeBuffer.hasRemaining(), is(false));
View Full Code Here

Examples of org.eclipse.jetty.io.MappedByteBufferPool

    public void testInvalidHeaderNameLength() throws Exception
    {
        Fields headers = new Fields();
        headers.add("broken", "header");
        SynStreamFrame frame = new SynStreamFrame(SPDY.V2, SynInfo.FLAG_CLOSE, 1, 0, (byte)0, (short)0, headers);
        Generator generator = new Generator(new MappedByteBufferPool(), new NoCompressionCompressionFactory.NoCompressionCompressor());

        ByteBuffer bufferWithBrokenHeaderNameLength = generator.control(frame);
        // Break the header name length to provoke the Parser to throw a StreamException
        bufferWithBrokenHeaderNameLength.put(21, (byte)0);
View Full Code Here

Examples of org.eclipse.jetty.io.MappedByteBufferPool

    {
        Fields headers = new Fields();
        headers.add("good", "header");
        headers.add("another","header");
        SynStreamFrame frame = new SynStreamFrame(SPDY.V2, SynInfo.FLAG_CLOSE, 1, 0, (byte)0, (short)0, headers);
        Generator generator = new Generator(new MappedByteBufferPool(), new NoCompressionCompressionFactory.NoCompressionCompressor());

        ByteBuffer bufferWithBrokenVersion = generator.control(frame);
        // Break the header name length to provoke the Parser to throw a StreamException
        bufferWithBrokenVersion.put(1, (byte)4);
View Full Code Here

Examples of org.eclipse.jetty.io.MappedByteBufferPool

        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();
View Full Code Here

Examples of org.eclipse.jetty.io.MappedByteBufferPool

    {
        Fields headers = new Fields();
        headers.add("good", "header");
        headers.add("another","header");
        SynStreamFrame frame = new SynStreamFrame(SPDY.V2, SynInfo.FLAG_CLOSE, 1, 0, (byte)0, (short)0, headers);
        Generator generator = new Generator(new MappedByteBufferPool(), new NoCompressionCompressionFactory.NoCompressionCompressor());

        ByteBuffer bufferWithBrokenVersion = generator.control(frame);
        // Break the header name length to provoke the Parser to throw a StreamException
        bufferWithBrokenVersion.put(1, (byte)4);
View Full Code Here

Examples of org.eclipse.jetty.io.MappedByteBufferPool

        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();
View Full Code Here

Examples of org.eclipse.jetty.io.MappedByteBufferPool

    {
        Fields headers = new Fields();
        headers.add("good", "header");
        headers.add("another","header");
        SynStreamFrame frame = new SynStreamFrame(SPDY.V2, SynInfo.FLAG_CLOSE, 1, 0, (byte)0, (short)0, headers);
        Generator generator = new Generator(new MappedByteBufferPool(), new NoCompressionCompressionFactory.NoCompressionCompressor());

        ByteBuffer bufferWithBrokenVersion = generator.control(frame);
        // Break the header name length to provoke the Parser to throw a StreamException
        bufferWithBrokenVersion.put(1, (byte)4);
View Full Code Here

Examples of org.eclipse.jetty.io.MappedByteBufferPool

                // Suppress exception logging for this test
            }
        });

        SynStreamFrame frame = new SynStreamFrame(SPDY.V2, SynInfo.FLAG_CLOSE, 1, 0, (byte)0, (short)0, new Fields());
        Generator generator = new Generator(new MappedByteBufferPool(), new StandardCompressionFactory.StandardCompressor());
        ByteBuffer buffer = generator.control(frame);
        // Replace the version byte with an unsupported version
        buffer.putShort(0, (short)0x8001);

        SocketChannel channel = SocketChannel.open(address);
View Full Code Here

Examples of org.eclipse.jetty.io.MappedByteBufferPool

    }

    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
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.