Merge pull request #1198 from drewhk/wip-3064-nonblocking-tcp-tests-drewhk

Removed blocking code from TcpConnectionSpec #3064
This commit is contained in:
drewhk 2013-02-26 01:55:52 -08:00
commit f8237d1c67

View file

@ -98,9 +98,12 @@ class TcpConnectionSpec extends AkkaSpec("akka.io.tcp.register-timeout = 500ms")
"receive data directly when the connection is established" in withUnacceptedConnection() { unregisteredSetup "receive data directly when the connection is established" in withUnacceptedConnection() { unregisteredSetup
import unregisteredSetup._ import unregisteredSetup._
localServer.configureBlocking(true) @volatile var serverSideChannel: SocketChannel = null
val serverSideChannel = localServer.accept() awaitCond {
serverSideChannel must not be (null) serverSideChannel = localServer.accept()
serverSideChannel != null
}
serverSideChannel.write(ByteBuffer.wrap("immediatedata".getBytes("ASCII"))) serverSideChannel.write(ByteBuffer.wrap("immediatedata".getBytes("ASCII")))
serverSideChannel.configureBlocking(false) serverSideChannel.configureBlocking(false)
@ -662,8 +665,11 @@ class TcpConnectionSpec extends AkkaSpec("akka.io.tcp.register-timeout = 500ms")
clientSocketOptions: immutable.Seq[SocketOption] = Nil)(body: RegisteredSetup Any): Unit = withUnacceptedConnection(setServerSocketOptions, createConnectionActor(options = clientSocketOptions)) { unregisteredSetup clientSocketOptions: immutable.Seq[SocketOption] = Nil)(body: RegisteredSetup Any): Unit = withUnacceptedConnection(setServerSocketOptions, createConnectionActor(options = clientSocketOptions)) { unregisteredSetup
import unregisteredSetup._ import unregisteredSetup._
localServer.configureBlocking(true) @volatile var serverSideChannel: SocketChannel = null
val serverSideChannel = localServer.accept() awaitCond {
serverSideChannel = localServer.accept()
serverSideChannel != null
}
serverSideChannel.configureBlocking(false) serverSideChannel.configureBlocking(false)
serverSideChannel must not be (null) serverSideChannel must not be (null)