if (null == timeoutHandler) {
ctx.pipeline().addFirst(READ_TIMEOUT_HANDLER_NAME, new ReadTimeoutHandler(timeout, timeUnit));
} else {
// This will always be invoked from the eventloop as it is a future listener callback.
ChannelHandlerContext handlerContext = ctx.pipeline().context(timeoutHandler);
timeoutHandler.handlerAdded(handlerContext);
}
}
});
super.write(ctx, msg, promise);
}