@Test public void invalidResponseMaxAge_usesDefault() throws Exception { SafeMethodCachingInterceptor interceptorWithCustomMaxAge = SafeMethodCachingInterceptor.newSafeMethodCachingInterceptor(cache, 1); channelToUse = ClientInterceptors.intercept(baseChannel, interceptorWithCustomMaxAge); cacheControlDirectives.add("max-age=-10"); HelloReply reply1 = ClientCalls.blockingUnaryCall( channelToUse, safeGreeterSayHelloMethod, CallOptions.DEFAULT, message); HelloReply reply2 = ClientCalls.blockingUnaryCall( channelToUse, safeGreeterSayHelloMethod, CallOptions.DEFAULT, message); assertEquals(reply1, reply2); sleepAtLeast(1001); assertNotEquals( reply1, ClientCalls.blockingUnaryCall( channelToUse, safeGreeterSayHelloMethod, CallOptions.DEFAULT, message)); Truth.assertThat(cache.removedKeys).hasSize(1); assertEquals( new SafeMethodCachingInterceptor.Key( GreeterGrpc.getSayHelloMethod().getFullMethodName(), message), cache.removedKeys.get(0)); }
public static SafeMethodCachingInterceptor newSafeMethodCachingInterceptor(Cache cache) { return newSafeMethodCachingInterceptor(cache, DEFAULT_MAX_AGE_SECONDS); }
SafeMethodCachingInterceptor implements ClientInterceptor { public static SafeMethodCachingInterceptor newSafeMethodCachingInterceptor(Cache cache) { return newSafeMethodCachingInterceptor(cache, DEFAULT_MAX_AGE_SECONDS); } }
SafeMethodCachingInterceptor implements ClientInterceptor { public static SafeMethodCachingInterceptor newSafeMethodCachingInterceptor(Cache cache) { return newSafeMethodCachingInterceptor(cache, DEFAULT_MAX_AGE_SECONDS); } private  SafeMethodCachingInterceptor(Cache cache, int defaultMaxAge); }
SafeMethodCachingInterceptor implements ClientInterceptor { public static SafeMethodCachingInterceptor newSafeMethodCachingInterceptor(Cache cache) { return newSafeMethodCachingInterceptor(cache, DEFAULT_MAX_AGE_SECONDS); } private  SafeMethodCachingInterceptor(Cache cache, int defaultMaxAge); static Cache newLruCache(final int cacheSizeInBytes); static SafeMethodCachingInterceptor newSafeMethodCachingInterceptor(Cache cache); static SafeMethodCachingInterceptor newSafeMethodCachingInterceptor(
      Cache cache, int defaultMaxAge); @Override ClientCall<ReqT, RespT> interceptCall(
      final MethodDescriptor<ReqT, RespT> method, final CallOptions callOptions, Channel next); }
SafeMethodCachingInterceptor implements ClientInterceptor { public static SafeMethodCachingInterceptor newSafeMethodCachingInterceptor(Cache cache) { return newSafeMethodCachingInterceptor(cache, DEFAULT_MAX_AGE_SECONDS); } private  SafeMethodCachingInterceptor(Cache cache, int defaultMaxAge); static Cache newLruCache(final int cacheSizeInBytes); static SafeMethodCachingInterceptor newSafeMethodCachingInterceptor(Cache cache); static SafeMethodCachingInterceptor newSafeMethodCachingInterceptor(
      Cache cache, int defaultMaxAge); @Override ClientCall<ReqT, RespT> interceptCall(
      final MethodDescriptor<ReqT, RespT> method, final CallOptions callOptions, Channel next);  }