'In C{connectionMade} of a client protocol, C{pauseProducing} used to be
ignored: this test is here to ensure it\'s not ignored.'

def test_pauseProducingInConnectionMade(self):

    server = MyServerFactory()
    client = MyClientFactory()
    client.protocolConnectionMade = defer.Deferred()
    port = reactor.listenTCP(0, server, interface='127.0.0.1')
    self.addCleanup(port.stopListening)
    connector = reactor.connectTCP(port.getHost().host, port.getHost().port, client)
    self.addCleanup(connector.disconnect)
    def checkInConnectionMade(proto):
        tr = proto.transport
        self.assertIn(tr, (reactor.getReaders() + reactor.getWriters()))
        proto.transport.pauseProducing()
        self.assertNotIn(tr, (reactor.getReaders() + reactor.getWriters()))
        d = defer.Deferred()
        d.addCallback(checkAfterConnectionMade)
        reactor.callLater(0, d.callback, proto)
        return d
    def checkAfterConnectionMade(proto):
        tr = proto.transport
        self.assertNotIn(tr, (reactor.getReaders() + reactor.getWriters()))
    client.protocolConnectionMade.addCallback(checkInConnectionMade)
    return client.protocolConnectionMade
