def getListeningPort(self, reactor, factory):
        """
        Get a UNIX port from a reactor, wrapping an already-initialized file
        descriptor.
        """
        portSock = socket(AF_UNIX)
        # self.mktemp() often returns a path which is too long to be used.
        path = mktemp(suffix='.sock', dir='.')
        portSock.bind(path)
        portSock.listen(3)
        portSock.setblocking(False)
        try:
            return reactor.adoptStreamPort(
                portSock.fileno(), portSock.family, factory)
        finally:
            portSock.close()

        Get a UNIX port from a reactor, wrapping an already-initialized file
        descriptor.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_unix.py