Package org.mockserver.netty.connection
Class InboundConnectionIdleHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
io.netty.handler.timeout.IdleStateHandler
org.mockserver.netty.connection.InboundConnectionIdleHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public final class InboundConnectionIdleHandler
extends io.netty.handler.timeout.IdleStateHandler
Closes an inbound connection that has read and written nothing for
inboundConnectionIdleTimeoutMillis
and has nothing in progress (see InboundConnectionActivity.isBusy(io.netty.channel.Channel)). A busy connection is left
alone and checked again after another full period of silence.
Installed first in the pipeline when the connection is accepted. TLS and SOCKS handlers added later
by protocol detection sit in front of it, so it observes decrypted application traffic rather than raw
socket bytes. A TLS handshake's records therefore never reach it: the handshake is covered by the busy
check while it runs, and its completion restarts the idle period, so the client has a whole period to
send its first request. The idle event is consumed here rather than fired down the pipeline, so no
other handler that reacts to IdleStateEvent can act on it.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionInboundConnectionIdleHandler(long idleTimeoutMillis, org.mockserver.logging.MockServerLogger mockServerLogger) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidchannelIdle(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.timeout.IdleStateEvent evt) voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx) voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) Methods inherited from class io.netty.handler.timeout.IdleStateHandler
channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, getAllIdleTimeInMillis, getReaderIdleTimeInMillis, getWriterIdleTimeInMillis, handlerRemoved, newIdleStateEvent, resetReadTimeout, resetWriteTimeout, writeMethods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, readMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelUnregistered, channelWritabilityChanged, exceptionCaughtMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Constructor Details
-
InboundConnectionIdleHandler
public InboundConnectionIdleHandler(long idleTimeoutMillis, org.mockserver.logging.MockServerLogger mockServerLogger)
-
-
Method Details
-
handlerAdded
- Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.handler.timeout.IdleStateHandler- Throws:
Exception
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception - Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelIdle
protected void channelIdle(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.timeout.IdleStateEvent evt) - Overrides:
channelIdlein classio.netty.handler.timeout.IdleStateHandler
-