HttpContext context = conn.getContext();
HttpResponse response = conn.getHttpResponse();
ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE);
ContentOutputBuffer buffer = connState.getOutbuffer();
// Update connection state
connState.setOutputState(ServerConnState.RESPONSE_BODY_STREAM);
try {
buffer.produceContent(encoder);
if (encoder.isCompleted()) {
connState.setOutputState(ServerConnState.RESPONSE_BODY_DONE);
connState.resetOutput();
if (!this.connStrategy.keepAlive(response, context)) {
conn.close();