=str #22124 fix failing TlsSpec "certificate check"

It seems the reason for the failure was that `Sink.head` canceled the
server binding before or while the first connection was being established
and handled. Using `mapAsync` instead will prevent that the binding is
canceled before the inner flow has finished.
This commit is contained in:
Johannes Rudolph 2017-03-24 15:46:45 +01:00 committed by Johan Andrén
parent 9abb73069c
commit 7b9342e324

View file

@ -396,15 +396,15 @@ class TlsSpec extends StreamSpec("akka.loglevel=DEBUG\nakka.actor.debug.receive=
// under error conditions, and has the bonus of matching most actual SSL deployments.
val (server, serverErr) = Tcp()
.bind("localhost", 0)
.map(c {
.mapAsync(1)(c
c.flow.joinMat(serverTls(IgnoreBoth).reversed.joinMat(simple)(Keep.right))(Keep.right).run()
})
)
.toMat(Sink.head)(Keep.both).run()
val clientErr = simple.join(badClientTls(IgnoreBoth))
.join(Tcp().outgoingConnection(Await.result(server, 1.second).localAddress)).run()
Await.result(serverErr.flatMap(identity), 1.second).getMessage should include("certificate_unknown")
Await.result(serverErr, 1.second).getMessage should include("certificate_unknown")
Await.result(clientErr, 1.second).getMessage should equal("General SSLEngine problem")
}