diff --git a/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala index cbed60cd92..ae79f265c6 100644 --- a/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala +++ b/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala @@ -793,8 +793,12 @@ class RemotingSpec extends PekkoSpec(RemotingSpec.cfg) with ImplicitSender with case _ => false } - outboundRemoteHandle.association.write(payload("after-handoff-failure")) - receiverProbe.expectMsg("after-handoff-failure") + // The read-only handle disassociation and resuming the outbound reader are handled by different actors. + // Retry until the outbound reader has processed ResumeReading. + awaitAssert { + outboundRemoteHandle.association.write(payload("after-handoff-failure")) + receiverProbe.expectMsg(500.millis, "after-handoff-failure") + } } finally shutdown(thisSystem) }