Examples of ResetGenerator


Examples of org.eclipse.jetty.http2.generator.ResetGenerator

    private final ByteBufferPool byteBufferPool = new MappedByteBufferPool();

    @Test
    public void testGenerateParse() throws Exception
    {
        ResetGenerator generator = new ResetGenerator(new HeaderGenerator());

        final List<ResetFrame> frames = new ArrayList<>();
        Parser parser = new Parser(byteBufferPool, new Parser.Listener.Adapter()
        {
            @Override
            public boolean onReset(ResetFrame frame)
            {
                frames.add(frame);
                return false;
            }
        }, 4096, 8192);

        int streamId = 13;
        int error = 17;

        // Iterate a few times to be sure generator and parser are properly reset.
        for (int i = 0; i < 2; ++i)
        {
            ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
            generator.generateReset(lease, streamId, error);

            frames.clear();
            for (ByteBuffer buffer : lease.getByteBuffers())
            {
                while (buffer.hasRemaining())
View Full Code Here

Examples of org.eclipse.jetty.http2.generator.ResetGenerator

    }

    @Test
    public void testGenerateParseOneByteAtATime() throws Exception
    {
        ResetGenerator generator = new ResetGenerator(new HeaderGenerator());

        final List<ResetFrame> frames = new ArrayList<>();
        Parser parser = new Parser(byteBufferPool, new Parser.Listener.Adapter()
        {
            @Override
            public boolean onReset(ResetFrame frame)
            {
                frames.add(frame);
                return false;
            }
        }, 4096, 8192);

        int streamId = 13;
        int error = 17;

        ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
        generator.generateReset(lease, streamId, error);

        for (ByteBuffer buffer : lease.getByteBuffers())
        {
            while (buffer.hasRemaining())
            {
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.