'If a L{IUNIXTransport.sendFileDescriptor} call fills up the send buffer,
any registered producer is paused.'

def test_sendFileDescriptorTriggersPauseProducing(self):

    class DoesNotRead(ConnectableProtocol, ):
        def connectionMade(self):
            self.transport.pauseProducing()
    class SendsManyFileDescriptors(ConnectableProtocol, ):
        paused = False
        def connectionMade(self):
            self.socket = socket()
            self.transport.registerProducer(self, True)
            def sender():
                self.transport.sendFileDescriptor(self.socket.fileno())
                self.transport.write('x')
            self.task = LoopingCall(sender)
            self.task.clock = self.transport.reactor
            self.task.start(0).addErrback(err, 'Send    loop    failure')
        def stopProducing(self):
            self._disconnect()
        def resumeProducing(self):
            self._disconnect()
        def pauseProducing(self):
            self.paused = True
            self.transport.unregisterProducer()
            self._disconnect()
        def _disconnect(self):
            self.task.stop()
            self.transport.abortConnection()
            self.other.transport.abortConnection()
    server = SendsManyFileDescriptors()
    client = DoesNotRead()
    server.other = client
    runProtocolsWithReactor(self, server, client, self.endpoints)
    self.assertTrue(server.paused, 'sendFileDescriptor    producer    was    not    paused')
