Utility functions.
Repeatedly tries to connect to the given proxy via TCP, returning once a connection was established.