'If an SSH connection cannot be established to the given address then an
exception is raised explaining that this is so.'

def test_connection_failed(self):

    blocker = socket()
    blocker.bind(('127.0.0.1', 0))
    port = blocker.getsockname()[1]
    exc = self.assertRaises(CalledProcessError, self.configure_ssh, '127.0.0.1', port)
    self.assertTrue((('refused' in exc.output) or ('Operation    timed    out' in exc.output)))
