Apply the changeset from https://code.launchpad.net/~redtoad/pyopenssl/pyopenssl/+merge/178226 by Sebastian Rahlf
diff --git a/OpenSSL/test/test_tsafe.py b/OpenSSL/test/test_tsafe.py
new file mode 100644
index 0000000..425f4e6
--- /dev/null
+++ b/OpenSSL/test/test_tsafe.py
@@ -0,0 +1,35 @@
+
+"""
+Unit tests for :py:obj:`OpenSSL.tsafe`.
+"""
+
+from OpenSSL import tsafe
+from OpenSSL.SSL import SSLv2_METHOD, SSLv3_METHOD, SSLv23_METHOD, TLSv1_METHOD
+from OpenSSL.SSL import Context
+from OpenSSL.test.util import TestCase, bytes, b
+from OpenSSL.test.test_ssl import _create_certificate_chain
+
+
+class ConnectionTest(TestCase):
+    """
+    Unit tests for :py:obj:`OpenSSL.tsafe.Connection`.
+    """
+
+    def test_instantiating_works_under_all_supported_Python_versions(self):
+        """
+        At least one library (namely `Werkzeug`_) is instantiating
+        :py:obj:`Connection` directly which previously did not work under
+        Python 3 (Bug #1211834: Python 3 Code Uses "apply" function).
+
+        .. _Werkzeug: http://werkzeug.pocoo.org
+        """
+        chain = _create_certificate_chain()
+        [(_, _), (ikey, icert), (skey, scert)] = chain
+
+        # Create the server context
+        ctx = Context(TLSv1_METHOD)
+        ctx.use_privatekey(skey)
+        ctx.use_certificate(scert)
+
+        # The following line should not throw an error
+        socket = tsafe.Connection(ctx, None)