avoid infinite blocking in TcpConnectionSpec #21375

* use socket timeout
* additional cleanup of socket utils
This commit is contained in:
Patrik Nordwall 2016-11-09 17:36:04 +01:00 committed by Johan Andrén
parent 72925ba392
commit 4f013a3d1e
8 changed files with 42 additions and 79 deletions

View file

@ -11,9 +11,9 @@ import akka.stream.scaladsl._
import akka.testkit.AkkaSpec
import akka.testkit.TestProbe
import akka.util.ByteString
import docs.utils.TestUtils
import scala.concurrent.Future
import akka.testkit.SocketUtil
class StreamTcpDocSpec extends AkkaSpec {
@ -37,7 +37,7 @@ class StreamTcpDocSpec extends AkkaSpec {
//#echo-server-simple-bind
}
{
val (host, port) = TestUtils.temporaryServerHostnameAndPort()
val (host, port) = SocketUtil.temporaryServerHostnameAndPort()
//#echo-server-simple-handle
import akka.stream.scaladsl.Framing
@ -62,7 +62,7 @@ class StreamTcpDocSpec extends AkkaSpec {
}
"initial server banner echo server" in {
val localhost = TestUtils.temporaryServerAddress()
val localhost = SocketUtil.temporaryServerAddress()
val connections = Tcp().bind(localhost.getHostName, localhost.getPort) // TODO getHostString in Java7
val serverProbe = TestProbe()