@Test public void multipleInvocationsOfHandler() { ServerInterceptor interceptor = Mockito.spy(new NoopInterceptor()); ServerServiceDefinition intercepted = ServerInterceptors.intercept(serviceDefinition, Arrays.asList(interceptor)); assertSame(listener, getSoleMethod(intercepted).getServerCallHandler().startCall(method, call, headers)); verify(interceptor).interceptCall( same(method), same(call), same(headers), anyCallHandler()); verify(handler).startCall(method, call, headers); verifyNoMoreInteractions(interceptor, handler); assertSame(listener, getSoleMethod(intercepted).getServerCallHandler().startCall(method, call, headers)); verify(interceptor, times(2)) .interceptCall(same(method), same(call), same(headers), anyCallHandler()); verify(handler, times(2)).startCall(method, call, headers); verifyNoMoreInteractions(interceptor, handler); }
public static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef, ServerInterceptor... interceptors) { return intercept(serviceDef, Arrays.asList(interceptors)); }
ServerInterceptors { public static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef, ServerInterceptor... interceptors) { return intercept(serviceDef, Arrays.asList(interceptors)); } }
ServerInterceptors { public static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef, ServerInterceptor... interceptors) { return intercept(serviceDef, Arrays.asList(interceptors)); } private  ServerInterceptors(); }
ServerInterceptors { public static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef, ServerInterceptor... interceptors) { return intercept(serviceDef, Arrays.asList(interceptors)); } private  ServerInterceptors(); static ServerServiceDefinition interceptForward(ServerServiceDefinition serviceDef,
                                                         ServerInterceptor... interceptors); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1701") static ServerServiceDefinition interceptForward(BindableService bindableService,
      ServerInterceptor... interceptors); static ServerServiceDefinition interceptForward(
      ServerServiceDefinition serviceDef,
      List<? extends ServerInterceptor> interceptors); static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef,
                                                  ServerInterceptor... interceptors); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1701") static ServerServiceDefinition intercept(BindableService bindableService,
      ServerInterceptor... interceptors); static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef,
                                                  List<? extends ServerInterceptor> interceptors); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1712") static ServerServiceDefinition useInputStreamMessages(
      final ServerServiceDefinition serviceDef); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1712") static ServerServiceDefinition useMarshalledMessages(
      final ServerServiceDefinition serviceDef,
      final MethodDescriptor.Marshaller<T> marshaller); }
ServerInterceptors { public static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef, ServerInterceptor... interceptors) { return intercept(serviceDef, Arrays.asList(interceptors)); } private  ServerInterceptors(); static ServerServiceDefinition interceptForward(ServerServiceDefinition serviceDef,
                                                         ServerInterceptor... interceptors); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1701") static ServerServiceDefinition interceptForward(BindableService bindableService,
      ServerInterceptor... interceptors); static ServerServiceDefinition interceptForward(
      ServerServiceDefinition serviceDef,
      List<? extends ServerInterceptor> interceptors); static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef,
                                                  ServerInterceptor... interceptors); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1701") static ServerServiceDefinition intercept(BindableService bindableService,
      ServerInterceptor... interceptors); static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef,
                                                  List<? extends ServerInterceptor> interceptors); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1712") static ServerServiceDefinition useInputStreamMessages(
      final ServerServiceDefinition serviceDef); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1712") static ServerServiceDefinition useMarshalledMessages(
      final ServerServiceDefinition serviceDef,
      final MethodDescriptor.Marshaller<T> marshaller);  }