Source:
public HttpServer(int httpPort) { HttpParams params = new SyncBasicHttpParams(); params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, SOCKET_TIMEOUT).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, SOCKET_BUFFER_SIZE).setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).setParameter(CoreProtocolPNames.ORIGIN_SERVER, SERVER_NAME); HttpRequestInterceptor[] requestInterceptors = new HttpRequestInterceptor[] { new RequestAcceptEncoding() }; HttpResponseInterceptor[] responseInterceptors = new HttpResponseInterceptor[] { new ResponseContentEncoding(), new ResponseDate(), new ResponseServer(), new ResponseContent(), new ResponseConnControl() }; HttpProcessor httpProcessor = new ImmutableHttpProcessor(requestInterceptors, responseInterceptors); HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry(); registry.register("/" + PROXY_RESOURCE_NAME + "/*", new ProxyAsyncRequestHandler(PROXY_RESOURCE_NAME, true)); registry.register("/" + LOCAL_RESOURCE_NAME + "/*", new ProxyAsyncRequestHandler(LOCAL_RESOURCE_NAME, false)); registry.register("*", new BasicAsyncRequestHandler(new BaseRequestHandler())); HttpAsyncService protocolHandler = new HttpAsyncService(httpProcessor, new DefaultConnectionReuseStrategy(), registry, params); NHttpConnectionFactory<DefaultNHttpServerConnection> connFactory = new DefaultNHttpServerConnectionFactory(params); final IOEventDispatch ioEventDispatch = new DefaultHttpServerIODispatch(protocolHandler, connFactory); final ListeningIOReactor ioReactor; try { ioReactor = new DefaultListeningIOReactor(); LOGGER.info("HttpStack listening on port {}", httpPort); ioReactor.listen(new InetSocketAddress(httpPort)); Thread listener = new Thread("HttpStack listener") { @Override public void run() { try { LOGGER.info("Submitted http listening to thread 'HttpStack listener'"); ioReactor.execute(ioEventDispatch); } catch (IOException e) { LOGGER.error("I/O Exception in HttpStack: {}", e); } LOGGER.info("Shutdown HttpStack"); } }; listener.setDaemon(false); listener.start(); LOGGER.info("HttpStack started"); } catch (IOException e) { LOGGER.error("I/O error: {}", e); } }

Target:
public HttpServer(int httpPort) { HttpParams params = new SyncBasicHttpParams(); params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, SOCKET_TIMEOUT).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, SOCKET_BUFFER_SIZE).setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).setParameter(CoreProtocolPNames.ORIGIN_SERVER, SERVER_NAME); HttpRequestInterceptor[] requestInterceptors = new HttpRequestInterceptor[] { new RequestAcceptEncoding() }; HttpResponseInterceptor[] responseInterceptors = new HttpResponseInterceptor[] { new ResponseContentEncoding(), new ResponseDate(), new ResponseServer(), new ResponseContent(), new ResponseConnControl() }; HttpProcessor httpProcessor = new ImmutableHttpProcessor(requestInterceptors, responseInterceptors); HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry(); registry.register("/" + PROXY_RESOURCE_NAME + "/*", new ProxyAsyncRequestHandler(PROXY_RESOURCE_NAME, true)); registry.register("/" + LOCAL_RESOURCE_NAME + "/*", new ProxyAsyncRequestHandler(LOCAL_RESOURCE_NAME, false)); registry.register("*", new BasicAsyncRequestHandler(new BaseRequestHandler())); HttpAsyncService protocolHandler = new HttpAsyncService(httpProcessor, new DefaultConnectionReuseStrategy(), registry, params); NHttpConnectionFactory<DefaultNHttpServerConnection> connFactory = new DefaultNHttpServerConnectionFactory(params); final IOEventDispatch ioEventDispatch = new DefaultHttpServerIODispatch(protocolHandler, connFactory); final ListeningIOReactor ioReactor; try { ioReactor = new DefaultListeningIOReactor(); LOGGER.info("HttpStack listening on port {}", httpPort); ioReactor.listen(new InetSocketAddress(httpPort)); Thread listener = new Thread("HttpStack listener") { @Override public void run() { try { LOGGER.info("Submitted http listening to thread 'HttpStack listener'"); ioReactor.execute(ioEventDispatch); } catch (IOException e) { LOGGER.error("I/O Exception in HttpStack", e); } LOGGER.info("Shutdown HttpStack"); } }; listener.setDaemon(false); listener.start(); LOGGER.info("HttpStack started"); } catch (IOException e) { LOGGER.error("I/O error", e); } }