ProxyOptions


class ProxyOptions
kotlin.Any
   ↳ android.net.http.ProxyOptions

Defines a proxy configuration that can be used by HttpEngine.

Summary

Constants
static Int

Allows direct, non-proxied, traffic.

static Int

Disallows direct traffic.

Public methods
static ProxyOptions
fromProxyList(proxyList: MutableList<Proxy!>, allProxiesFailedBehavior: Int)

Constructs a proxy configuration out of a list of Proxy.

Constants

ALL_PROXIES_FAILED_BEHAVIOR_ALLOW_DIRECT

static val ALL_PROXIES_FAILED_BEHAVIOR_ALLOW_DIRECT: Int

Allows direct, non-proxied, traffic.

This defines a fail-open behavior: if all proxies in a ProxyOptions have failed, HttpEngine will fall back onto non-proxied connections.

Value: 1

ALL_PROXIES_FAILED_BEHAVIOR_DISALLOW_DIRECT

static val ALL_PROXIES_FAILED_BEHAVIOR_DISALLOW_DIRECT: Int

Disallows direct traffic.

This defines a fail-closed behavior: if all proxies in a ProxyOptions have failed, HttpEngine won't fall back onto non-proxied connections.

Value: 0

Public methods

fromProxyList

static fun fromProxyList(
    proxyList: MutableList<Proxy!>,
    allProxiesFailedBehavior: Int
): ProxyOptions

Constructs a proxy configuration out of a list of Proxy.

Proxies in the list will be used in order. Proxy in position N+1 will be used only if HttpEngine failed to use proxy in position N. If proxy in position N fails, for any reason (including tunnel closures triggered via Proxy.HttpConnectCallback), but proxy in position N+1 succeeds, proxies in position N will be temporarily deprioritized. While a proxy is deprioritized it will be used only as a last resort.

Parameters
proxyList MutableList<Proxy!>: The list of Proxy that defines this configuration.
This value cannot be null.
allProxiesFailedBehavior Int: How HttpEngine must behave after it has failed to use all proxies in proxyList.
Value is one of the following:
Return
ProxyOptions This value cannot be null.
Exceptions
java.lang.IllegalArgumentException If the proxy list is empty, or any element is null.