Replaced 'Thread.sleep' with 'CountDownLatch' to fix the flaky test failures
Merge pull request #731 from zsxwing/flaky-unit-tests

Replaced 'Thread.sleep' with 'CountDownLatch' to fix the flaky test failures