diff --git a/akka-stream-tests/src/test/scala/akka/stream/scaladsl/StreamRefsSpec.scala b/akka-stream-tests/src/test/scala/akka/stream/scaladsl/StreamRefsSpec.scala index 003f487a4a..94747d2eeb 100644 --- a/akka-stream-tests/src/test/scala/akka/stream/scaladsl/StreamRefsSpec.scala +++ b/akka-stream-tests/src/test/scala/akka/stream/scaladsl/StreamRefsSpec.scala @@ -419,7 +419,9 @@ class StreamRefsSpec extends AkkaSpec(StreamRefsSpec.config()) { // "concurrently" ks.shutdown() - remoteControl.success(None) + // note that while unlikely the killswitch shutdown can already have reached the source.maybe and in that case the + // remoteControl is already completed here + remoteControl.trySuccess(None) // since it is a race we can only confirm that it either completes or fails both sides // if it didn't work