@Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (isResponseHeaders(msg)) {
            // Update the request count attribute for this channel.
            requestCount++;

            if (isConnectionExpired(ctx.channel())) {
                // Flag this channel to be closed after response is written.
                Channel channel = HttpUtils.getMainChannel(ctx);
                ctx.channel()
                        .attr(ConnectionCloseChannelAttributes.CLOSE_AFTER_RESPONSE)
                        .set(ctx.newPromise());
                ConnectionCloseType.setForChannel(channel, connectionCloseType);
            }
        }

        super.write(ctx, msg, promise);
    }
User: michaels@netflix.com
Date: 7/17/17
Time: 10:54 AM
zuul-core/src/main/java/com/netflix/netty/common/AbstrHttpConnectionExpiryHandler.java