code: protected HttpHandler wrapWithDispatcher(final HttpHandler handler) {
          return new HttpHandler() {
              public void handleRequest(HttpServerExchange exchange) throws Exception {
                  if (exchange.isInIoThread()) {
                      exchange.dispatch(handler);
                  } else {
                      handler.handleRequest(exchange);
                  }
              }
          };
      }
docs: /*
  Ensure that handler isn't invoked on IO thread but rather
  dispatched to the worker thread pool