def test_rude_shutdown(self):
            listener_ready = threading.Event()
            listener_gone = threading.Event()

            s = socket.socket()
            port = test_support.bind_port(s, HOST)

            # `listener` runs in a thread.  It sits in an accept() until
            # the main thread connects.  Then it rudely closes the socket,
            # and sets Event `listener_gone` to let the main thread know
            # the socket is gone.
            def listener():
                s.listen(5)
                listener_ready.set()
                s.accept()
                s.close()
                listener_gone.set()

            def connector():
                listener_ready.wait()
                c = socket.socket()
                c.connect((HOST, port))
                listener_gone.wait()
                try:
                    ssl_sock = ssl.wrap_socket(c)
                except IOError:
                    pass
                else:
                    self.fail('connecting to closed SSL socket should have failed')

            t = threading.Thread(target=listener)
            t.start()
            try:
                connector()
            finally:
                t.join()
.. todo::
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_ssl.py/ThreadedTests.test_rude_shutdown--crossover with--dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/sandbox/cuda_convnet/stochastic_pool.py/StochasticMaxPool.c_lib_dirs