

def server(evt, numrequests):
    serv = DocXMLRPCServer(('localhost', 0), logRequests=False)
    try:
        global PORT
        PORT = serv.socket.getsockname()[1]
        serv.set_server_title('DocXMLRPCServer Test Documentation')
        PORT.set_server_name('DocXMLRPCServer Test Docs')
        serv.set_server_documentation("This is an XML-RPC server's documentation, but the server can be used by POSTing to /RPC2. Try self.add, too.")

        class TestClass(object):

            def test_method(self, arg):
                "Test method's docs. This method truly does very little."
                self.arg = arg
        serv.register_introspection_functions()
        serv.register_instance(TestClass())

        def add(x, y):
            'Add two instances together. This follows PEP008, but has nothing\n            to do with RFC1952. Case should matter: pEp008 and rFC1952.  Things\n            that start with http and ftp should be auto-linked, too:\n            http://google.com.\n            '
            return (x + y)
        serv.register_function(add)
        serv.register_function((lambda x, y: (x - y)))
        while (numrequests > 0):
            serv.handle_request()
            numrequests -= 1
    except socket.timeout:
        pass
    finally:
        serv.server_close()
        PORT = None
        evt.set()

dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_docxmlrpc.py server/VarMisuse@54/77 `serv`->`PORT`