@Test public void argumentsPassed() { @SuppressWarnings("unchecked") final ServerCall<String, Integer> call2 = new NoopServerCall<String, Integer>(); @SuppressWarnings("unchecked") final ServerCall.Listener<String> listener2 = mock(ServerCall.Listener.class); ServerInterceptor interceptor = new ServerInterceptor() { @SuppressWarnings("unchecked") @Override public <R1, R2> ServerCall.Listener<R1> interceptCall( ServerCall<R1, R2> call, Metadata headers, ServerCallHandler<R1, R2> next) { assertSame(call, ServerInterceptorsTest.this.call); assertSame(listener, next.startCall((ServerCall<R1, R2>)call2, headers)); return (ServerCall.Listener<R1>) listener2; } }; ServerServiceDefinition intercepted = ServerInterceptors.intercept( serviceDefinition, Arrays.asList(interceptor)); assertSame(listener2, getSoleMethod(intercepted).getServerCallHandler().startCall(call, headers)); verify(handler).startCall(call2, headers); }
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); static ServerServiceDefinition interceptForward(BindableService bindableService,
      ServerInterceptor... interceptors); static ServerServiceDefinition interceptForward(
      ServerServiceDefinition serviceDef,
      List<? extends ServerInterceptor> interceptors); static ServerServiceDefinition interceptForward(
      BindableService bindableService,
      List<? extends ServerInterceptor> interceptors); static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef,
                                                  ServerInterceptor... interceptors); static ServerServiceDefinition intercept(BindableService bindableService,
      ServerInterceptor... interceptors); static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef,
                                                  List<? extends ServerInterceptor> interceptors); static ServerServiceDefinition intercept(BindableService bindableService,
      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); static ServerServiceDefinition interceptForward(BindableService bindableService,
      ServerInterceptor... interceptors); static ServerServiceDefinition interceptForward(
      ServerServiceDefinition serviceDef,
      List<? extends ServerInterceptor> interceptors); static ServerServiceDefinition interceptForward(
      BindableService bindableService,
      List<? extends ServerInterceptor> interceptors); static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef,
                                                  ServerInterceptor... interceptors); static ServerServiceDefinition intercept(BindableService bindableService,
      ServerInterceptor... interceptors); static ServerServiceDefinition intercept(ServerServiceDefinition serviceDef,
                                                  List<? extends ServerInterceptor> interceptors); static ServerServiceDefinition intercept(BindableService bindableService,
      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);  }