Fix unit test case to use CountDownLatch