@Test public void keepAliveAllowedWithNoActiveStreams() { KeepAliveManager manager = newManager(true); manager.channelIdle(); verifyWrite(instanceOf(Http2PingFrame.class)); }
void channelIdle() { assert channel.eventLoop().inEventLoop(); assert pingWriteCompletionListener != null; if (keepAliveState != null || disallowKeepAliveWithoutActiveStreams && activeChildChannels == 0) { return; } keepAliveState = KEEP_ALIVE_ACK_PENDING; channel.writeAndFlush(new DefaultHttp2PingFrame(KEEP_ALIVE_PING_CONTENT, false)) .addListener(pingWriteCompletionListener); }
KeepAliveManager { void channelIdle() { assert channel.eventLoop().inEventLoop(); assert pingWriteCompletionListener != null; if (keepAliveState != null || disallowKeepAliveWithoutActiveStreams && activeChildChannels == 0) { return; } keepAliveState = KEEP_ALIVE_ACK_PENDING; channel.writeAndFlush(new DefaultHttp2PingFrame(KEEP_ALIVE_PING_CONTENT, false)) .addListener(pingWriteCompletionListener); } }
KeepAliveManager { void channelIdle() { assert channel.eventLoop().inEventLoop(); assert pingWriteCompletionListener != null; if (keepAliveState != null || disallowKeepAliveWithoutActiveStreams && activeChildChannels == 0) { return; } keepAliveState = KEEP_ALIVE_ACK_PENDING; channel.writeAndFlush(new DefaultHttp2PingFrame(KEEP_ALIVE_PING_CONTENT, false)) .addListener(pingWriteCompletionListener); } KeepAliveManager(final Channel channel, @Nullable final KeepAlivePolicy keepAlivePolicy);   KeepAliveManager(final Channel channel, @Nullable final KeepAlivePolicy keepAlivePolicy,
                     final Scheduler scheduler, final IdlenessDetector idlenessDetector); }
KeepAliveManager { void channelIdle() { assert channel.eventLoop().inEventLoop(); assert pingWriteCompletionListener != null; if (keepAliveState != null || disallowKeepAliveWithoutActiveStreams && activeChildChannels == 0) { return; } keepAliveState = KEEP_ALIVE_ACK_PENDING; channel.writeAndFlush(new DefaultHttp2PingFrame(KEEP_ALIVE_PING_CONTENT, false)) .addListener(pingWriteCompletionListener); } KeepAliveManager(final Channel channel, @Nullable final KeepAlivePolicy keepAlivePolicy);   KeepAliveManager(final Channel channel, @Nullable final KeepAlivePolicy keepAlivePolicy,
                     final Scheduler scheduler, final IdlenessDetector idlenessDetector);  }
KeepAliveManager { void channelIdle() { assert channel.eventLoop().inEventLoop(); assert pingWriteCompletionListener != null; if (keepAliveState != null || disallowKeepAliveWithoutActiveStreams && activeChildChannels == 0) { return; } keepAliveState = KEEP_ALIVE_ACK_PENDING; channel.writeAndFlush(new DefaultHttp2PingFrame(KEEP_ALIVE_PING_CONTENT, false)) .addListener(pingWriteCompletionListener); } KeepAliveManager(final Channel channel, @Nullable final KeepAlivePolicy keepAlivePolicy);   KeepAliveManager(final Channel channel, @Nullable final KeepAlivePolicy keepAlivePolicy,
                     final Scheduler scheduler, final IdlenessDetector idlenessDetector);   }