diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index c09fd63230255581cf230bb4bc4b966656a90055_TGliL3Rlc3QvdGVzdF9zc2wucHk=..34af10e633e3292ee10aa75450d798b07d183537_TGliL3Rlc3QvdGVzdF9zc2wucHk= 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -558,6 +558,17 @@
             finally:
                 s.close()
 
+    def test_connect_ex_error(self):
+        with support.transient_internet("svn.python.org"):
+            s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+                                cert_reqs=ssl.CERT_REQUIRED,
+                                ca_certs=SVN_PYTHON_ORG_ROOT_CERT)
+            try:
+                self.assertEqual(errno.ECONNREFUSED,
+                                 s.connect_ex(("svn.python.org", 444)))
+            finally:
+                s.close()
+
     def test_connect_with_context(self):
         with support.transient_internet("svn.python.org"):
             # Same as test_connect, but with a separately created context