Exemplo n.º 1
0
function unimplementedMethod($stub)
{
    $call = $stub->UnimplementedCall(new grpc\testing\EmptyMessage());
    list($result, $status) = $call->wait();
    hardAssert($status->code === Grpc\STATUS_UNIMPLEMENTED, 'Received unexpected status code');
}
Exemplo n.º 2
0
function timeoutOnSleepingServer($stub)
{
    $call = $stub->FullDuplexCall([], ['timeout' => 1000]);
    $request = new grpc\testing\StreamingOutputCallRequest();
    $request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE);
    $response_parameters = new grpc\testing\ResponseParameters();
    $response_parameters->setSize(8);
    $request->addResponseParameters($response_parameters);
    $payload = new grpc\testing\Payload();
    $payload->setBody(str_repeat("", 9));
    $request->setPayload($payload);
    $call->write($request);
    $response = $call->read();
    hardAssert($call->getStatus()->code === Grpc\STATUS_DEADLINE_EXCEEDED, 'Call status was not DEADLINE_EXCEEDED');
}
Exemplo n.º 3
0
function cancelAfterFirstResponse($stub)
{
    $call = $stub->FullDuplexCall();
    $request = new grpc\testing\StreamingOutputCallRequest();
    $request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE);
    $response_parameters = new grpc\testing\ResponseParameters();
    $response_parameters->setSize(31415);
    $request->addResponseParameters($response_parameters);
    $payload = new grpc\testing\Payload();
    $payload->setBody(str_repeat("", 27182));
    $request->setPayload($payload);
    $call->write($request);
    $response = $call->read();
    $call->cancel();
    hardAssert($call->getStatus()->code === Grpc\STATUS_CANCELLED, 'Call status was not CANCELLED');
}