Merge pull request #1729 from jrudolph/wip-3602-fix-connected

=act #3602 report `Connected` only when connection attempt was successful
This commit is contained in:
Björn Antonsson 2013-10-16 03:54:38 -07:00
commit f6179da523
3 changed files with 17 additions and 4 deletions

View file

@ -139,6 +139,7 @@ class TcpConnectionSpec extends AkkaSpec("""
serverSideChannel.write(ByteBuffer.wrap("immediatedata".getBytes("ASCII")))
serverSideChannel.configureBlocking(false)
interestCallReceiver.expectMsg(OP_CONNECT)
selector.send(connectionActor, ChannelConnectable)
userHandler.expectMsg(Connected(serverAddress, clientSideChannel.socket.getLocalSocketAddress.asInstanceOf[InetSocketAddress]))
@ -799,7 +800,7 @@ class TcpConnectionSpec extends AkkaSpec("""
lazy val clientSideChannel = connectionActor.underlyingActor.channel
override def run(body: Unit): Unit = super.run {
registerCallReceiver.expectMsg(Registration(clientSideChannel, OP_CONNECT))
registerCallReceiver.expectMsg(Registration(clientSideChannel, 0))
registerCallReceiver.sender must be(connectionActor)
body
}
@ -821,6 +822,7 @@ class TcpConnectionSpec extends AkkaSpec("""
serverSideChannel.configureBlocking(false)
serverSideChannel must not be (null)
interestCallReceiver.expectMsg(OP_CONNECT)
selector.send(connectionActor, ChannelConnectable)
userHandler.expectMsg(Connected(serverAddress, clientSideChannel.socket.getLocalSocketAddress.asInstanceOf[InetSocketAddress]))