Recover from SSL protocol exceptions.

Previously this appeared to work, but only because our test environment
usually had multiple IP addresses for localhost.