async def _test_call(): client = RPCClient(path=PATH) ret = await client.call_once('echo', 'message') eq_('message', ret) eq_(client._conn.is_closed(), True) # Make sure we can make another call after we do a call_once ret = await client.call_once('echo', 'message again') eq_('message again', ret)
from aiorpc import RPCClient import asyncio import uvloop async def do(cli): ret = await client.call('echo', 'message') print("{}\n".format(ret)) loop = uvloop.new_event_loop() asyncio.set_event_loop(loop) client = RPCClient('127.0.0.1', 6000) loop.run_until_complete(do(client)) client.close()
async def _test_context_manager(): async with RPCClient(HOST, PORT) as client: ret = await client.call('echo', 'message') eq_('message', ret)
async def _test_call(): client = RPCClient(path=PATH) ret = await client.call('echo', 'message') eq_('message', ret) client.close()
async def _test_call(): client = RPCClient(HOST, PORT) ret = await client.call('echo', 'message') eq_('message', ret) client.close()
async def _test_call_socket_timeout(): client = RPCClient(path=PATH, timeout=1) await client.call('echo_delayed', 'message', 10) client.close()