Add some ugly sleep workarounds in test to try get passing on Travis.