Test: fix waitForMessage API