def test_connectionLostOnShutdown(self):
        """
        Any file descriptors added to the reactor have their C{connectionLost}
        called when C{reactor.stop} is called.
        """
        reactor = self.buildReactor()

        class DoNothingDescriptor(FileDescriptor):
            def doRead(self):
                return None
            def doWrite(self):
                return None

        client, server = self._connectedPair()

        fd1 = DoNothingDescriptor(reactor)
        fd1.fileno = client.fileno
        fd2 = DoNothingDescriptor(reactor)
        fd2.fileno = server.fileno
        reactor.addReader(fd1)
        reactor.addWriter(fd2)

        reactor.callWhenRunning(reactor.stop)
        self.runReactor(reactor)
        self.assertTrue(fd1.disconnected)
        self.assertTrue(fd2.disconnected)

        Any file descriptors added to the reactor have their C{connectionLost}
        called when C{reactor.stop} is called.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_fdset.py