Change connection-refused test from localhost to 127.0.0.1.

This might be contributing to occasional timeouts on travis-ci
(on the theory that some other test may be listening on the
same port on ::1).

Also explicitly stop the test if connect_callback is called.