Fix a bug where socket timeouts would not be catched when wrapping SSL.