Merge pull request #16025 from drewhk/wip-http-bind-failure-testcase-drewhk

=htc Add test case for bind failures
This commit is contained in:
drewhk 2014-10-03 10:18:30 +02:00
commit fbdd0dc5de

View file

@ -11,7 +11,7 @@ import scala.annotation.tailrec
import scala.concurrent.Await
import scala.concurrent.duration._
import org.scalatest.{ BeforeAndAfterAll, Matchers, WordSpec }
import akka.actor.ActorSystem
import akka.actor.{ Status, ActorSystem }
import akka.io.IO
import akka.testkit.TestProbe
import akka.stream.FlowMaterializer
@ -56,6 +56,21 @@ class ClientServerSpec extends WordSpec with Matchers with BeforeAndAfterAll {
// TODO: verify unbinding effect
}
"report failure if bind fails" in {
val (hostname, port) = temporaryServerHostnameAndPort()
val commander = TestProbe()
commander.send(IO(Http), Http.Bind(hostname, port))
val binding = commander.expectMsgType[Http.ServerBinding]
commander.send(IO(Http), Http.Bind(hostname, port))
commander.expectMsgType[Status.Failure]
// Clean up
val c = StreamTestKit.SubscriberProbe[Http.IncomingConnection]()
binding.connectionStream.subscribe(c)
val sub = c.expectSubscription()
sub.cancel()
}
"properly complete a simple request/response cycle" in new TestSetup {
val (clientOut, clientIn) = openNewClientConnection[Symbol]()
val (serverIn, serverOut) = acceptConnection()