@Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        // Close the connection immediately after LastContent is written, rather than
        // waiting until the graceful-delay is up if this flag is set.
        if (isEndOfRequestResponse(msg)) {
            Channel parent = HttpUtils.getMainChannel(ctx);
            ChannelPromise closeAfterPromise = shouldCloseAfter(ctx, parent);
            if (closeAfterPromise != null) {

                // Add listener to close the channel AFTER response has been sent.
                promise.addListener(future -> {
                    // Close the parent (tcp connection) channel.
                    closeChannel(ctx, closeAfterPromise);
                });
            }
        }

        super.write(ctx, msg, promise);
    }
User: michaels@netflix.com
Date: 2/8/17
Time: 2:03 PM
zuul-core/src/main/java/com/netflix/netty/common/Http2ConnectionCloseHandler.java