akka/akka — pull request #1729 by jrudolph (2013-09-12 09:31:01+00:00)
Title: =act #3602 report `Connected` only when connection attempt was successful

Before this change, a client connection was always instantly reported as `Connected`, even if the endpoint would never respond at all.

The reason is a weird behavior of OP_CONNECT and SocketChannel in the JDK (observed in Linux):
- a channel is always connectable before the connection is attempted (`channel.connect`). Selecting for OP_CONNECT before the `connect` call will instantly report connectable
- even worse: after OP_CONNECT was reported true, also `finishConnect` will always return true, even if the connection wasn't yet established. That's probably the case because `finishConnect` is internally implemented depending on previous epoll results (on Linux).