def raw(respw, server, transport, **kwargs): rpc = RPC( service='client', outbounds={ 'yarpc-test': tr.factory(server, transport), }, ) expected = rand.string(7) request = Request(procedure='echo/raw', body=expected, ttl=10000) client = RawClient(rpc.channel('yarpc-test')) response = yield client.call(request) if response.body == expected: respw.success("Server said: %s" % response.body) else: respw.fail("expected %s, got %s" % (expected, response.body))
class RawCaller(object): def __init__(self, channel): self._client = RawClient(channel) def call(self, headers): request = Request( procedure='echo/raw', ttl=10000, headers=headers, ) return self._client.call(request)
def __init__(self, channel): self._client = RawClient(channel)