// Create client-side HTTP protocol handler
HttpAsyncClientProtocolHandler protocolHandler = new HttpAsyncClientProtocolHandler();
// Create client-side I/O event dispatch
final IOEventDispatch ioEventDispatch = new DefaultClientIODispatch(protocolHandler, params);
// Create client-side I/O reactor
IOReactorConfig config = new IOReactorConfig();
config.setIoThreadCount(1);
final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(config);
// Create HTTP connection pool
BasicNIOConnPool pool = new BasicNIOConnPool(ioReactor, params);
// Limit total number of connections to just two
pool.setDefaultMaxPerRoute(2);