Wait for the RPC Server to start before testing

When creating the RPC Server thread, a dummy event is added to the
event loop. When the event loop has fully started, the dummy event
unregisters itself and allows setup_env() to return.

This fixes a race condition on my system, where test_connect_failed
would fail so fast that the server ioloop didn't start by the time
the test teardown would request the ioloop to stop.
Explicitly use an unused port in test_connect_failed()

Instead of guessing to find an unused port, use helper.unused_port()
to find one. The test might otherwise fail if something is listening
in the high ports and the Client collides with it.
Merge pull request #14 from hufman/fix-test-race

Fix test race