Inlining JUnit4TestBase.waitFor since it is used in one place.