io.netty.handler.codec.http2.Http2GoAwayFrame Java Examples
The following examples show how to use
io.netty.handler.codec.http2.Http2GoAwayFrame.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: H2ParentConnectionContext.java From servicetalk with Apache License 2.0 | 6 votes |
@Override public final void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof Http2SettingsFrame) { if (ackSettings(ctx, (Http2SettingsFrame) msg)) { ctx.writeAndFlush(Http2SettingsAckFrame.INSTANCE); } } else if (msg instanceof Http2GoAwayFrame) { Http2GoAwayFrame goAwayFrame = (Http2GoAwayFrame) msg; goAwayFrame.release(); parentContext.onClosing.onComplete(); // We trigger the graceful close process here (with no timeout) to make sure the socket is closed once // the existing streams are closed. The MultiplexCodec may simulate a GOAWAY when the stream IDs are // exhausted so we shouldn't rely upon our peer to close the transport. parentContext.keepAliveManager.initiateGracefulClose(parentContext.onClosing::onComplete); } else if (msg instanceof Http2PingFrame) { parentContext.keepAliveManager.pingReceived((Http2PingFrame) msg); } else { ctx.fireChannelRead(msg); } }
Example #2
Source File: Http2MetricsChannelHandlers.java From zuul with Apache License 2.0 | 6 votes |
protected static void incrementCounter(Registry registry, String counterName, String metricId, Http2Frame frame) { long errorCode; if (frame instanceof Http2ResetFrame) { errorCode = ((Http2ResetFrame) frame).errorCode(); } else if (frame instanceof Http2GoAwayFrame) { errorCode = ((Http2GoAwayFrame) frame).errorCode(); } else { errorCode = -1; } registry.counter(counterName, "id", metricId, "frame", frame.name(), "error_code", Long.toString(errorCode)) .increment(); }
Example #3
Source File: KeepAliveManagerTest.java From servicetalk with Apache License 2.0 | 5 votes |
private Http2PingFrame initiateGracefulCloseVerifyGoAwayAndPing(final KeepAliveManager manager) { manager.initiateGracefulClose(() -> { }); Http2GoAwayFrame firstGoAway = verifyWrite(instanceOf(Http2GoAwayFrame.class)); assertThat("Unexpected error in go_away", firstGoAway.errorCode(), is(Http2Error.NO_ERROR.code())); Http2PingFrame pingFrame = verifyWrite(instanceOf(Http2PingFrame.class)); verifyNoWrite(); return pingFrame; }
Example #4
Source File: KeepAliveManagerTest.java From servicetalk with Apache License 2.0 | 4 votes |
private void verifySecondGoAway() { Http2GoAwayFrame secondGoAway = verifyWrite(instanceOf(Http2GoAwayFrame.class)); assertThat("Unexpected error in go_away", secondGoAway.errorCode(), is(Http2Error.NO_ERROR.code())); verifyNoScheduledTasks(); }
Example #5
Source File: KeepAliveManagerTest.java From servicetalk with Apache License 2.0 | 4 votes |
private void verifyChannelCloseOnMissingPingAck(final ScheduledTask ackTimeoutTask) { ackTimeoutTask.task.run(); verifyWrite(instanceOf(Http2GoAwayFrame.class)); verifyNoScheduledTasks(); assertThat("Channel not closed.", channel.isOpen(), is(false)); }
Example #6
Source File: ServerNotRespondingTest.java From aws-sdk-java-v2 with Apache License 2.0 | 4 votes |
@Override protected void channelRead0(ChannelHandlerContext ctx, Http2GoAwayFrame msg) { LOGGER.info(() -> "goaway" + ctx.channel()); closedByClientH2ConnectionCount.incrementAndGet(); msg.release(); }