Package org.eclipse.jetty.http2

Examples of org.eclipse.jetty.http2.HTTP2Stream


        Session.Listener listener = (Session.Listener)context.get(SESSION_LISTENER_CONTEXT_KEY);
        @SuppressWarnings("unchecked")
        Promise<Session> promise = (Promise<Session>)context.get(SESSION_PROMISE_CONTEXT_KEY);

        Generator generator = new Generator(byteBufferPool, 4096);
        HTTP2ClientSession session = new HTTP2ClientSession(scheduler, endPoint, generator, listener, new HTTP2FlowControl(FlowControl.DEFAULT_WINDOW_SIZE));
        Parser parser = new Parser(byteBufferPool, session, 4096, 8192);
        return new HTTP2ClientConnection(client, byteBufferPool, executor, endPoint, parser, session, 8192, false, promise, listener);
    }
View Full Code Here


    {
        if (LOG.isDebugEnabled())
            LOG.debug("Received {}", frame);

        int streamId = frame.getStreamId();
        IStream stream = getStream(streamId);
        if (stream == null)
        {
            if (LOG.isDebugEnabled())
                LOG.debug("Ignoring {}, stream #{} not found", frame, streamId);
        }
        else
        {
            stream.updateClose(frame.isEndStream(), false);
            stream.process(frame, Callback.Adapter.INSTANCE);
            notifyHeaders(stream, frame);
            if (stream.isClosed())
                removeStream(stream, false);
        }
        return false;
    }
View Full Code Here

        if (LOG.isDebugEnabled())
            LOG.debug("Received {}", frame);

        int streamId = frame.getStreamId();
        int pushStreamId = frame.getPromisedStreamId();
        IStream stream = getStream(streamId);
        if (stream == null)
        {
            if (LOG.isDebugEnabled())
                LOG.debug("Ignoring {}, stream #{} not found", frame, streamId);
        }
        else
        {
            IStream pushStream = createRemoteStream(pushStreamId);
            pushStream.updateClose(true, true);
            pushStream.process(frame, Callback.Adapter.INSTANCE);
            Stream.Listener listener = notifyPush(stream, pushStream, frame);
            pushStream.setListener(listener);
            if (pushStream.isClosed())
                removeStream(pushStream, false);
        }
        return false;
    }
View Full Code Here

            parseResponse(client, parser);

            // We need to give some time to the server to receive and process the TCP FIN.
            Thread.sleep(1000);

            Session session = sessionRef.get();
            Assert.assertTrue(session.isClosed());
            Assert.assertTrue(((HTTP2Session)session).isDisconnected());
        }
    }
View Full Code Here

            // Client received the TCP FIN from server.
            Assert.assertEquals(-1, client.getInputStream().read());

            // Server is closed.
            Session session = sessionRef.get();
            Assert.assertTrue(session.isClosed());
            Assert.assertTrue(((HTTP2Session)session).isDisconnected());
        }
    }
View Full Code Here

            // Client received the TCP FIN from server.
            Assert.assertEquals(-1, client.getInputStream().read());

            // Server is closed.
            Session session = sessionRef.get();
            Assert.assertTrue(session.isClosed());
            Assert.assertTrue(((HTTP2Session)session).isDisconnected());
        }
    }
View Full Code Here

            HeadersFrame response = headersRef.get();
            Assert.assertNotNull(response);
            MetaData.Response responseMetaData = (MetaData.Response)response.getMetaData();
            Assert.assertEquals(200, responseMetaData.getStatus());

            DataFrame responseData = dataRef.get();
            Assert.assertNotNull(responseData);
            Assert.assertArrayEquals(content, BufferUtil.toArray(responseData.getData()));
        }
    }
View Full Code Here

        return Result.PENDING;
    }

    private boolean onData(ByteBuffer buffer, boolean fragment, int padding)
    {
        DataFrame frame = new DataFrame(getStreamId(), buffer, !fragment && isEndStream(), padding);
        return notifyData(frame);
    }
View Full Code Here

        ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
        generator.control(lease, new PrefaceFrame());
        MetaData.Request metaData = newRequest("GET", new HttpFields());
        generator.control(lease, new HeadersFrame(1, metaData, null, true));
        generator.control(lease, new GoAwayFrame(1, ErrorCodes.NO_ERROR, "OK".getBytes("UTF-8")));

        try (Socket client = new Socket("localhost", connector.getLocalPort()))
        {
            OutputStream output = client.getOutputStream();
            for (ByteBuffer buffer : lease.getByteBuffers())
View Full Code Here

        return Result.PENDING;
    }

    private Result onGoAway(int lastStreamId, int error, byte[] payload)
    {
        GoAwayFrame frame = new GoAwayFrame(lastStreamId, error, payload);
        reset();
        return notifyGoAway(frame) ? Result.ASYNC : Result.COMPLETE;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.http2.HTTP2Stream

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.