Package org.mockserver.httpclient
Class TimeToFirstByteHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
org.mockserver.httpclient.TimeToFirstByteHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public class TimeToFirstByteHandler
extends io.netty.channel.ChannelInboundHandlerAdapter
Records the wall-clock time when the first inbound byte (response head) arrives
from the upstream server. This handler fires once on the first
channelRead
and then removes itself from the pipeline so subsequent reads pay zero overhead.
The timestamp is stored in the channel attribute FIRST_BYTE_MILLIS so
that NettyHttpClient can compute timeToFirstByteInMillis when
building the Timing object.
Extends ChannelInboundHandlerAdapter (not SimpleChannelInboundHandler)
to avoid auto-release of the proxied message. A firstByte value of 0 means
"not captured".
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
TimeToFirstByteHandler
public TimeToFirstByteHandler()
-
-
Method Details
-
channelRead
- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-