def test_serviceStoppedCausesLeftoverGlobalDeferredsToErrback(self):
        """
        Once the service is stopped any leftover global deferred returned by
        a sendGlobalRequest() call must be errbacked.
        """
        self.conn.serviceStarted()

        d = self.conn.sendGlobalRequest(
            b"dummyrequest", b"dummydata", wantReply=1)
        d = self.assertFailure(d, error.ConchError)
        self.conn.serviceStopped()
        return d

        Once the service is stopped any leftover global deferred returned by
        a sendGlobalRequest() call must be errbacked.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_connection.py