Use latches instead of sleep for unit test

As per suggestion at https://github.com/benjchristensen/RxJava/commit/5b317ad827f624bed6cbf5f2e04df050ebbe01d0#commitcomment-5839773
comments to walk through logic