tests: connect rather than sleep to test readiness

This should fix a recurring issue with Valgrind test in Travis-CI runs,
the one second sleep is not always enough time for the proxy to fully
start when preforming tests.