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

Fixed the test failure in https://github.com/Netflix/RxJava/issues/383#issuecomment-30081304