Refactor wait_for_reactor tests so they can be reused with similar APIs.