@Test public void ifOneServerResponds503WithNoRetryHeaderTheRequestIsRerouted() { RETRY_OTHER_FIRST_RESPONSE_TRANSFORMER.registerUrl(getUriForPort(availablePort1)); RETRY_OTHER_FIRST_RESPONSE_TRANSFORMER.registerUrl(getUriForPort(availablePort2)); TestResource client = AtlasDbHttpClients.createProxyWithFailover( MetricsManagers.createForTests(), ImmutableServerListConfig.builder() .addServers(getUriForPort(availablePort1)) .addServers(getUriForPort(availablePort2)) .sslConfiguration(SSL_CONFIG) .build(), TestResource.class, AUXILIARY_REMOTING_PARAMETERS); int response = client.getTestNumber(); RequestPattern request = getRequestedFor(urlMatching(GET_ENDPOINT)).build(); assertThat(availableServer1.findRequestsMatching(request).getRequests()) .hasSizeGreaterThanOrEqualTo(1); assertThat(availableServer2.findRequestsMatching(request).getRequests()) .hasSizeGreaterThanOrEqualTo(1); assertThat(response) .isIn(TEST_NUMBER_1, TEST_NUMBER_2); RETRY_OTHER_FIRST_RESPONSE_TRANSFORMER.reset(); }
public static <T> T createProxyWithFailover( MetricsManager metricsManager, ServerListConfig serverListConfig, Class<T> type, AuxiliaryRemotingParameters parameters) { Supplier<T> clientFactory = () -> instrument( metricsManager.getTaggedRegistry(), ConjureJavaRuntimeTargetFactory.DEFAULT.createProxyWithFailover(serverListConfig, type, parameters), type); return wrapWithOkHttpBugHandling(type, clientFactory); }
AtlasDbHttpClients { public static <T> T createProxyWithFailover( MetricsManager metricsManager, ServerListConfig serverListConfig, Class<T> type, AuxiliaryRemotingParameters parameters) { Supplier<T> clientFactory = () -> instrument( metricsManager.getTaggedRegistry(), ConjureJavaRuntimeTargetFactory.DEFAULT.createProxyWithFailover(serverListConfig, type, parameters), type); return wrapWithOkHttpBugHandling(type, clientFactory); } }
AtlasDbHttpClients { public static <T> T createProxyWithFailover( MetricsManager metricsManager, ServerListConfig serverListConfig, Class<T> type, AuxiliaryRemotingParameters parameters) { Supplier<T> clientFactory = () -> instrument( metricsManager.getTaggedRegistry(), ConjureJavaRuntimeTargetFactory.DEFAULT.createProxyWithFailover(serverListConfig, type, parameters), type); return wrapWithOkHttpBugHandling(type, clientFactory); } private  AtlasDbHttpClients(); }
AtlasDbHttpClients { public static <T> T createProxyWithFailover( MetricsManager metricsManager, ServerListConfig serverListConfig, Class<T> type, AuxiliaryRemotingParameters parameters) { Supplier<T> clientFactory = () -> instrument( metricsManager.getTaggedRegistry(), ConjureJavaRuntimeTargetFactory.DEFAULT.createProxyWithFailover(serverListConfig, type, parameters), type); return wrapWithOkHttpBugHandling(type, clientFactory); } private  AtlasDbHttpClients(); static T createProxy(
            Optional<TrustContext> trustContext,
            String uri,
            Class<T> type,
            AuxiliaryRemotingParameters parameters); static T createProxyWithFailover(
            MetricsManager metricsManager,
            ServerListConfig serverListConfig,
            Class<T> type,
            AuxiliaryRemotingParameters parameters); static T createLiveReloadingProxyWithFailover(
            MetricsManager metricsManager,
            Supplier<ServerListConfig> serverListConfigSupplier,
            Class<T> type,
            AuxiliaryRemotingParameters clientParameters); static T createDialogueProxy(TaggedMetricRegistry registry, Class<T> type, Channel channel); static T createUninstrumentedDialogueProxy(Class<T> type, Channel channel); }
AtlasDbHttpClients { public static <T> T createProxyWithFailover( MetricsManager metricsManager, ServerListConfig serverListConfig, Class<T> type, AuxiliaryRemotingParameters parameters) { Supplier<T> clientFactory = () -> instrument( metricsManager.getTaggedRegistry(), ConjureJavaRuntimeTargetFactory.DEFAULT.createProxyWithFailover(serverListConfig, type, parameters), type); return wrapWithOkHttpBugHandling(type, clientFactory); } private  AtlasDbHttpClients(); static T createProxy(
            Optional<TrustContext> trustContext,
            String uri,
            Class<T> type,
            AuxiliaryRemotingParameters parameters); static T createProxyWithFailover(
            MetricsManager metricsManager,
            ServerListConfig serverListConfig,
            Class<T> type,
            AuxiliaryRemotingParameters parameters); static T createLiveReloadingProxyWithFailover(
            MetricsManager metricsManager,
            Supplier<ServerListConfig> serverListConfigSupplier,
            Class<T> type,
            AuxiliaryRemotingParameters clientParameters); static T createDialogueProxy(TaggedMetricRegistry registry, Class<T> type, Channel channel); static T createUninstrumentedDialogueProxy(Class<T> type, Channel channel);  }