@Override
        public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
            RequestState state = ctx.channel().attr(ATTR_REQ_STATE).get();

            if (msg instanceof HttpResponse) {
                state.response = (HttpResponse) msg;
                state.responseBodySize = 0;
            }

            if (msg instanceof HttpContent) {
                state.responseBodySize += ((HttpContent) msg).content().readableBytes();
            }

            super.write(ctx, msg, promise);
        }
User: michaels@netflix.com
Date: 4/14/16
Time: 3:51 PM
zuul-core/src/main/java/com/netflix/netty/common/accesslog/AccessLogChannelHandler.java