Handles Errno::ECONNREFUSED

This now handles one more exception type and refactors the tests to be
less repetitive and more comprehensive.