def setUp(self): self.rpcserver = rpc.rpcserver(PORT) self.rpcserver.add_handler('SDAPlotter', lambda plotter_method_name, *args: (plotter_method_name, args)) six.moves._thread.start_new_thread(self.rpcserver.serve_forever, ()) self.plot = plot.plotter() plot.setremoteport(PORT)
def testSingleIntegerArg(self): rpcserver = rpc.rpcserver(PORT) rpcserver.add_handler("echo", lambda o: o) thread.start_new_thread(rpcserver.serve_forever, ()) try: rpcclient = rpc.rpcclient(PORT) self.assertRaises(Exception, rpcclient.flaterror, (18,)) finally: rpcserver.shutdown() rpcserver.close()
def testExceptionOnHandlerFlattening(self): rpcserver = rpc.rpcserver(PORT) rpcserver.add_handler("flaterror", lambda o: object()) thread.start_new_thread(rpcserver.serve_forever, ()) try: rpcclient = rpc.rpcclient(PORT) self.assertRaises(Exception, rpcclient.flaterror, ("Hello",)) finally: rpcserver.shutdown() rpcserver.close()
def testBasic(self): rpcserver = rpc.rpcserver(PORT) rpcserver.add_handler("cat", catTwoStrings) six.moves._thread.start_new_thread(rpcserver.serve_forever, ()) try: rpcclient = rpc.rpcclient(PORT) result = rpcclient.cat("Hello, ", "World!") self.assertEqual("Hello, World!", result) finally: rpcserver.shutdown() rpcserver.close()
def testBasic(self): rpcserver = rpc.rpcserver(PORT) rpcserver.add_handler("cat", catTwoStrings) thread.start_new_thread(rpcserver.serve_forever, ()) try: rpcclient = rpc.rpcclient(PORT) result = rpcclient.cat("Hello, ", "World!") self.assertEqual("Hello, World!", result) finally: rpcserver.shutdown() rpcserver.close()
def testMultipleHandlers(self): rpcserver = rpc.rpcserver(PORT) rpcserver.add_handler("cat", lambda s1, s2: s1 + s2) rpcserver.add_handler("len", lambda s1, s2: len(s1 + s2)) thread.start_new_thread(rpcserver.serve_forever, ()) try: rpcclient = rpc.rpcclient(PORT) result = rpcclient.cat("Hello, ", "World!") self.assertEqual("Hello, World!", result) result = rpcclient.len("Hello, ", "World!") self.assertEqual(len("Hello, World!"), result) finally: rpcserver.shutdown() rpcserver.close()
def testMultipleHandlers(self): rpcserver = rpc.rpcserver(PORT) rpcserver.add_handler("cat", lambda s1, s2: s1 + s2) rpcserver.add_handler("len", lambda s1, s2: len(s1 + s2)) six.moves._thread.start_new_thread(rpcserver.serve_forever, ()) try: rpcclient = rpc.rpcclient(PORT) result = rpcclient.cat("Hello, ", "World!") self.assertEqual("Hello, World!", result) result = rpcclient.len("Hello, ", "World!") self.assertEqual(len("Hello, World!"), result) finally: rpcserver.shutdown() rpcserver.close()
def setUp(self): self.rpcserver = rpc.rpcserver(PORT) self.rpcserver.add_handler("cat", lambda s1, s2: s1 + s2) six.moves._thread.start_new_thread(self.rpcserver.serve_forever, ()) self.rpcclient = rpc.rpcclient(PORT)
def setUp(self): self.rpcserver = rpc.rpcserver(PORT) self.rpcserver.add_handler("cat", lambda s1, s2: s1 + s2) thread.start_new_thread(self.rpcserver.serve_forever, ()) self.rpcclient = rpc.rpcclient(PORT)