From 7b9342e3244bc4fbd67fb0dc026f1766dae9207f Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Fri, 24 Mar 2017 15:46:45 +0100 Subject: [PATCH] =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. --- .../src/test/scala/akka/stream/io/TlsSpec.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/akka-stream-tests/src/test/scala/akka/stream/io/TlsSpec.scala b/akka-stream-tests/src/test/scala/akka/stream/io/TlsSpec.scala index 0de5205481..65d5fe577c 100644 --- a/akka-stream-tests/src/test/scala/akka/stream/io/TlsSpec.scala +++ b/akka-stream-tests/src/test/scala/akka/stream/io/TlsSpec.scala @@ -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") }