test: use "receive" event to detect message is sent instead of wait()

wait() makes test fragile.