Ejemplo n.º 1
0
 public InteropTester(String testCase, ManagedChannel channel, TestListener listener) {
   this.testCase = testCase;
   this.listener = listener;
   this.channel = channel;
   blockingStub = TestServiceGrpc.newBlockingStub(channel);
   asyncStub = TestServiceGrpc.newStub(channel);
 }
Ejemplo n.º 2
0
 public void deadlineNotExceeded() {
   // warm up the channel and JVM
   blockingStub.emptyCall(new EmptyProtos.Empty());
   StreamingOutputCallRequest request = new StreamingOutputCallRequest();
   request.responseParameters = new ResponseParameters[1];
   request.responseParameters[0] = new ResponseParameters();
   request.responseParameters[0].intervalUs = 0;
   TestServiceGrpc.newBlockingStub(channel)
       .withDeadlineAfter(10, TimeUnit.SECONDS)
       .streamingOutputCall(request);
 }
Ejemplo n.º 3
0
 public void deadlineExceeded() {
   // warm up the channel and JVM
   blockingStub.emptyCall(new EmptyProtos.Empty());
   TestServiceGrpc.TestServiceBlockingStub stub =
       TestServiceGrpc.newBlockingStub(channel).withDeadlineAfter(10, TimeUnit.MILLISECONDS);
   StreamingOutputCallRequest request = new StreamingOutputCallRequest();
   request.responseParameters = new ResponseParameters[1];
   request.responseParameters[0] = new ResponseParameters();
   request.responseParameters[0].intervalUs = 20000;
   try {
     stub.streamingOutputCall(request).next();
     fail("Expected deadline to be exceeded");
   } catch (StatusRuntimeException ex) {
     assertCodeEquals(io.grpc.Status.DEADLINE_EXCEEDED, ex.getStatus());
   }
 }