final NHttpServerConnection conn, final Exception cause) {
final State state = ensureNotNull(getState(conn));
if (state != null) {
state.setTerminated();
closeHandlers(state, cause);
final Cancellable cancellable = state.getCancellable();
if (cancellable != null) {
cancellable.cancel();
}
if (cause instanceof HttpException) {
if (conn.isResponseSubmitted()
|| state.getResponseState().compareTo(MessageState.INIT) > 0) {
// There is not much that we can do if a response