Esempio n. 1
0
    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)
Esempio n. 2
0
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()
Esempio n. 3
0
 async def _test_context_manager():
     async with RPCClient(HOST, PORT) as client:
         ret = await client.call('echo', 'message')
         eq_('message', ret)
Esempio n. 4
0
    async def _test_call():
        client = RPCClient(path=PATH)
        ret = await client.call('echo', 'message')

        eq_('message', ret)
        client.close()
Esempio n. 5
0
    async def _test_call():
        client = RPCClient(HOST, PORT)
        ret = await client.call('echo', 'message')

        eq_('message', ret)
        client.close()
Esempio n. 6
0
    async def _test_call_socket_timeout():
        client = RPCClient(path=PATH, timeout=1)

        await client.call('echo_delayed', 'message', 10)
        client.close()