CircuitBreakerRpcClient extends AbstractCircuitBreakerClient<RpcRequest, RpcResponse> implements RpcClient { public static CircuitBreakerRpcClientBuilder builder( CircuitBreakerRuleWithContent<RpcResponse> ruleWithContent) { return new CircuitBreakerRpcClientBuilder(ruleWithContent); } CircuitBreakerRpcClient(RpcClient delegate, CircuitBreakerMapping mapping,
                            CircuitBreakerRuleWithContent<RpcResponse> ruleWithContent); static Function<? super RpcClient, CircuitBreakerRpcClient> newDecorator(CircuitBreaker circuitBreaker, CircuitBreakerRuleWithContent<RpcResponse> ruleWithContent); static Function<? super RpcClient, CircuitBreakerRpcClient> newDecorator(CircuitBreakerMapping mapping, CircuitBreakerRuleWithContent<RpcResponse> ruleWithContent); static Function<? super RpcClient, CircuitBreakerRpcClient> newPerMethodDecorator(Function<String, ? extends CircuitBreaker> factory,
                          CircuitBreakerRuleWithContent<RpcResponse> ruleWithContent); static Function<? super RpcClient, CircuitBreakerRpcClient> newPerHostDecorator(Function<String, ? extends CircuitBreaker> factory,
                        CircuitBreakerRuleWithContent<RpcResponse> ruleWithContent); static Function<? super RpcClient, CircuitBreakerRpcClient> newPerHostAndMethodDecorator(BiFunction<String, String, ? extends CircuitBreaker> factory,
                                 CircuitBreakerRuleWithContent<RpcResponse> ruleWithContent); static CircuitBreakerRpcClientBuilder builder(
            CircuitBreakerRuleWithContent<RpcResponse> ruleWithContent);  }
@Test void testDelegate() throws Exception { final CircuitBreaker circuitBreaker = CircuitBreaker.builder(remoteServiceName) .ticker(() -> 0) .build(); final RpcClient delegate = mock(RpcClient.class); when(delegate.execute(any(), any())).thenReturn(successRes); final CircuitBreakerRpcClient stub = new CircuitBreakerRpcClient(delegate, (ctx, req) -> circuitBreaker, rule()); stub.execute(ctxA, reqA); verify(delegate, times(1)).execute(eq(ctxA), eq(reqA)); }