/** * Returns a Feign {@link Client} wrapping an {@link okhttp3.OkHttpClient}. This {@link Client} recreates * itself in the event that either {@link CounterBackedRefreshingClient#DEFAULT_REQUEST_COUNT_BEFORE_REFRESH} * requests have been made, or if {@link ExceptionCountingRefreshingClient#DEFAULT_EXCEPTION_COUNT_BEFORE_REFRESH} * consecutive exceptions have been thrown by the underlying client. */ public static Client newRefreshingOkHttpClient( Optional<TrustContext> trustContext, Optional<ProxySelector> proxySelector, String userAgent) { Supplier<Client> clientSupplier = () -> CounterBackedRefreshingClient.createRefreshingClient( () -> newOkHttpClient(trustContext, proxySelector, userAgent)); return ExceptionCountingRefreshingClient.createRefreshingClient(clientSupplier); }
public static <T> T createRsProxy( Optional<TrustContext> trustContext, String uri, Class<T> type, String userAgent) { return Feign.builder() .contract(contract) .encoder(encoder) .decoder(decoder) .errorDecoder(new RsErrorDecoder()) .client(FeignOkHttpClients.newOkHttpClient(trustContext, Optional.empty(), userAgent)) .target(type, uri); }
public static <T> T createProxy( Optional<TrustContext> trustContext, String uri, boolean refreshingHttpClient, Class<T> type, String userAgent) { return Feign.builder() .contract(contract) .encoder(encoder) .decoder(decoder) .errorDecoder(errorDecoder) .retryer(new InterruptHonoringRetryer()) .client(refreshingHttpClient ? FeignOkHttpClients.newRefreshingOkHttpClient(trustContext, Optional.empty(), userAgent) : FeignOkHttpClients.newOkHttpClient(trustContext, Optional.empty(), userAgent)) .target(type, uri); }
/** * Returns a Feign {@link Client} wrapping an {@link okhttp3.OkHttpClient}. This {@link Client} recreates * itself in the event that either {@link CounterBackedRefreshingClient#DEFAULT_REQUEST_COUNT_BEFORE_REFRESH} * requests have been made, or if {@link ExceptionCountingRefreshingClient#DEFAULT_EXCEPTION_COUNT_BEFORE_REFRESH} * consecutive exceptions have been thrown by the underlying client. */ public static Client newRefreshingOkHttpClient( Optional<TrustContext> trustContext, Optional<ProxySelector> proxySelector, String userAgent) { Supplier<Client> clientSupplier = () -> CounterBackedRefreshingClient.createRefreshingClient( () -> newOkHttpClient(trustContext, proxySelector, userAgent)); return ExceptionCountingRefreshingClient.createRefreshingClient(clientSupplier); }
public static <T> T createRsProxy( Optional<TrustContext> trustContext, String uri, Class<T> type, String userAgent) { return Feign.builder() .contract(contract) .encoder(encoder) .decoder(decoder) .errorDecoder(new RsErrorDecoder()) .client(FeignOkHttpClients.newOkHttpClient(trustContext, Optional.empty(), userAgent)) .target(type, uri); }
public static <T> T createProxy( Optional<TrustContext> trustContext, String uri, boolean refreshingHttpClient, Class<T> type, String userAgent) { return Feign.builder() .contract(contract) .encoder(encoder) .decoder(decoder) .errorDecoder(errorDecoder) .retryer(new InterruptHonoringRetryer()) .client(refreshingHttpClient ? FeignOkHttpClients.newRefreshingOkHttpClient(trustContext, Optional.empty(), userAgent) : FeignOkHttpClients.newOkHttpClient(trustContext, Optional.empty(), userAgent)) .target(type, uri); }