State state = getState(conn);
if (state != null) {
if (state.getRequestState().compareTo(MessageState.READY) != 0) {
state.invalidate();
HttpAsyncRequestExecutionHandler<?> handler = getHandler(conn);
handler.failed(new ConnectionClosedException("Connection closed"));
}
}
// Closing connection in an orderly manner and
// waiting for output buffer to get flushed.
// Do not want to wait indefinitely, though, in case