Removed blocking code from TcpConnectionSpec #3064

This commit is contained in:
Endre Sándor Varga 2013-02-25 13:50:11 +01:00
parent 84ae28c4e9
commit 185771c91d

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)