'L{IUNIXTransport.sendFileDescriptor} accepts an integer file descriptor
and sends a copy of it to the process reading from the connection.'

def test_sendFileDescriptor(self):

    from socket import fromfd
    s = socket()
    s.bind(('', 0))
    server = SendFileDescriptor(s.fileno(), 'junk')
    client = ReceiveFileDescriptor()
    d = client.waitForDescriptor()
    def checkDescriptor(descriptor):
        received = fromfd(descriptor, AF_INET, SOCK_STREAM)
        close(descriptor)
        self.assertEqual(s.getsockname(), received.getsockname())
        self.assertNotEqual(s.fileno(), received.fileno())
    d.addCallback(checkDescriptor)
    d.addErrback(err, 'Sending    file    descriptor    encountered    a    problem')
    d.addBoth((lambda ignored: server.transport.loseConnection()))
    runProtocolsWithReactor(self, server, client, self.endpoints)
