I've implemented an async server stream of messages and I have tests that call the rpc, then cause a message to be sent from the server, and then wait for the onNext()
.
Sometimes the tests fail because the rpc call arrives to the server after I cause a message. If I add a sleep of 300 millisecond on the server side, it fails consistently.
I've tried adding withWaitForReady()
and it didn't help.
Is there a standard way to block an async stub until the method on the server side is finished?