=htc Add test case for bind failures
This commit is contained in:
parent
35867800f9
commit
7dab9636e4
1 changed files with 16 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue