Index: httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java =================================================================== --- httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java (revision 937961) +++ httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java (working copy) @@ -247,22 +247,17 @@ return; } + SessionRequestHandle requestHandle = new SessionRequestHandle(request); SelectionKey key; try { - key = socketChannel.register(this.selector, 0); + key = socketChannel.register(this.selector, SelectionKey.OP_CONNECT, requestHandle); request.setKey(key); + } catch (CancelledKeyException ex) { + // Ignore cancelled keys } catch (IOException ex) { throw new IOReactorException("Failure registering channel " + "with the selector", ex); } - - SessionRequestHandle requestHandle = new SessionRequestHandle(request); - try { - key.attach(requestHandle); - key.interestOps(SelectionKey.OP_CONNECT); - } catch (CancelledKeyException ex) { - // Ignore cancelled keys - } } } Index: httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java =================================================================== --- httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java (revision 937961) +++ httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java (working copy) @@ -364,7 +364,7 @@ try { channel = entry.getChannel(); channel.configureBlocking(false); - key = channel.register(this.selector, 0); + key = channel.register(this.selector, SelectionKey.OP_READ); } catch (ClosedChannelException ex) { SessionRequestImpl sessionRequest = entry.getSessionRequest(); if (sessionRequest != null) {