Examples of GoAwayFrame


Examples of org.eclipse.jetty.http2.frames.GoAwayFrame

        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

Examples of org.eclipse.jetty.http2.frames.GoAwayFrame

        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

Examples of org.eclipse.jetty.http2.frames.GoAwayFrame

                case NOT_CLOSED:
                {
                    if (closed.compareAndSet(current, CloseState.LOCALLY_CLOSED))
                    {
                        byte[] payload = reason == null ? null : reason.getBytes(StandardCharsets.UTF_8);
                        GoAwayFrame frame = new GoAwayFrame(lastStreamId.get(), error, payload);
                        if (LOG.isDebugEnabled())
                            LOG.debug("Sending {}", frame);
                        control(null, callback, frame);
                        return;
                    }
View Full Code Here

Examples of org.eclipse.jetty.http2.frames.GoAwayFrame

    }

    @Override
    public void generate(ByteBufferPool.Lease lease, Frame frame)
    {
        GoAwayFrame goAwayFrame = (GoAwayFrame)frame;
        generateGoAway(lease, goAwayFrame.getLastStreamId(), goAwayFrame.getError(), goAwayFrame.getPayload());
    }
View Full Code Here

Examples of org.eclipse.jetty.spdy.frames.GoAwayFrame

    {
        if (goAwaySent.compareAndSet(false, true))
        {
            if (!goAwayReceived.get())
            {
                GoAwayFrame frame = new GoAwayFrame(version, lastStreamId.get(), sessionStatus.getCode());
                control(null, frame, timeout, unit, callback);
                return;
            }
        }
        complete(callback);
View Full Code Here

Examples of org.eclipse.jetty.spdy.frames.GoAwayFrame

        assertThat("no unexpected exceptions occurred", unexpectedExceptionOccurred.get(), is(false));
        assertThat("not all dataframes have been received as the pushstream has been reset by the client.", allDataFramesReceivedLatch.await(streamId, TimeUnit.SECONDS), is(false));


        ByteBuffer buffer = generator.control(new GoAwayFrame(version, streamId, SessionStatus.OK.getCode()));
        channel.write(buffer);
        Assert.assertThat(buffer.hasRemaining(), is(false));

        assertThat("GoAway frame is received by server", goAwayReceivedLatch.await(5, TimeUnit.SECONDS), is(true));
        channel.shutdownOutput();
View Full Code Here

Examples of org.eclipse.jetty.spdy.frames.GoAwayFrame

    }

    @Override
    public ByteBuffer generate(ControlFrame frame)
    {
        GoAwayFrame goAway = (GoAwayFrame)frame;

        int frameBodyLength = 8;
        int totalLength = ControlFrame.HEADER_LENGTH + frameBodyLength;
        ByteBuffer buffer = getByteBufferPool().acquire(totalLength, Generator.useDirectBuffers);
        BufferUtil.clearToFill(buffer);
        generateControlFrameHeader(goAway, frameBodyLength, buffer);

        buffer.putInt(goAway.getLastStreamId() & 0x7F_FF_FF_FF);
        writeStatusCode(goAway, buffer);

        buffer.flip();
        return buffer;
    }
View Full Code Here

Examples of org.eclipse.jetty.spdy.frames.GoAwayFrame

        return false;
    }

    private void onGoAway()
    {
        GoAwayFrame frame = new GoAwayFrame(controlFrameParser.getVersion(), lastStreamId, statusCode);
        controlFrameParser.onControlFrame(frame);
        reset();
    }
View Full Code Here

Examples of org.eclipse.jetty.spdy.frames.GoAwayFrame

        parser.parse(response);

        assertThat("server didn't receive data",serverDataReceivedLatch.await(1,TimeUnit.SECONDS),not(true));
        assertThat("client didn't receive reset",clientResetReceivedLatch.await(1,TimeUnit.SECONDS),not(true));

        ByteBuffer buffer = generator.control(new GoAwayFrame(version, streamId, SessionStatus.OK.getCode()));
        socketChannel.write(buffer);
        Assert.assertThat(buffer.hasRemaining(), is(false));

        assertThat("GoAway frame is received by server", goAwayReceivedLatch.await(5,TimeUnit.SECONDS), is(true));
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.