def test_reactorStoppedOnSuccessfulConnection(self):
        """
        If the exhauster fails to trigger C{EMFILE} and a connection
        reaches the server, the reactor is stopped and the test fails.
        """
        exhauster = self.NullExhauster()
        serverFactory = [None]

        def runReactor(reactor):
            reactor.run()
            proto = serverFactory[0].buildProtocol(
                IPv4Address('TCP', '127.0.0.1', 4321))
            proto.makeConnection(StringTransport())

        def listen(reactor, factory):
            port = reactor.listenTCP('127.0.0.1', 1234, factory)
            factory.doStart()
            serverFactory[0] = factory
            return port

        def connect(reactor, address, factory):
            reactor.connectTCP('127.0.0.1', 0, factory)

        exception = self.assertRaises(
            self.testCase.failureException,
            assertPeerClosedOnEMFILE,
            testCase=self.testCase,
            exhauster=exhauster,
            reactor=self.reactor,
            runReactor=runReactor,
            listen=listen,
            connect=connect,
        )

        self.assertIn("EMFILE", str(exception))
        self.assertFalse(self.reactor.running)

        If the exhauster fails to trigger C{EMFILE} and a connection
        reaches the server, the reactor is stopped and the test fails.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_tcp.py