-
public final class AddressA specification for a connection to an origin server. For simple connections, this is the server's hostname and port. If an explicit proxy is requested (or no proxy is explicitly requested), this also includes that proxy information. For secure connections the address also includes the SSL socket factory, hostname verifier, and certificate pinner.
HTTP requests that share the same
{@code Address}may also share the same Connection.
-
-
Constructor Summary
Constructors Constructor Description Address(String uriHost, int uriPort, Dns dns, SocketFactory socketFactory, SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier, CertificatePinner certificatePinner, Authenticator proxyAuthenticator, Proxy proxy, List<Protocol> protocols, List<ConnectionSpec> connectionSpecs, ProxySelector proxySelector)
-
Method Summary
Modifier and Type Method Description HttpUrlurl()Returns a URL with the hostname and port of the origin server. Dnsdns()Returns the service that will be used to resolve IP addresses for hostnames. SocketFactorysocketFactory()Returns the socket factory for new connections. AuthenticatorproxyAuthenticator()Returns the client's proxy authenticator. List<Protocol>protocols()Returns the protocols the client supports. List<ConnectionSpec>connectionSpecs()ProxySelectorproxySelector()Returns this address's proxy selector. Proxyproxy()Returns this address's explicitly-specified HTTP proxy, or null to delegate to the proxy selector. SSLSocketFactorysslSocketFactory()Returns the SSL socket factory, or null if this is not an HTTPS address. HostnameVerifierhostnameVerifier()Returns the hostname verifier, or null if this is not an HTTPS address. CertificatePinnercertificatePinner()Returns this address's certificate pinner, or null if this is not an HTTPS address. booleanequals(@Nullable() Object other)inthashCode()StringtoString()-
-
Constructor Detail
-
Address
Address(String uriHost, int uriPort, Dns dns, SocketFactory socketFactory, SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier, CertificatePinner certificatePinner, Authenticator proxyAuthenticator, Proxy proxy, List<Protocol> protocols, List<ConnectionSpec> connectionSpecs, ProxySelector proxySelector)
-
-
Method Detail
-
url
HttpUrl url()
Returns a URL with the hostname and port of the origin server. The path, query, and fragment ofthis URL are always empty, since they are not significant for planning a route.
-
socketFactory
SocketFactory socketFactory()
Returns the socket factory for new connections.
-
proxyAuthenticator
Authenticator proxyAuthenticator()
Returns the client's proxy authenticator.
-
protocols
List<Protocol> protocols()
Returns the protocols the client supports. This method always returns a non-null list thatcontains minimally HTTP_1_1.
-
connectionSpecs
List<ConnectionSpec> connectionSpecs()
-
proxySelector
ProxySelector proxySelector()
Returns this address's proxy selector. Only used if the proxy is null. If none of thisselector's proxies are reachable, a direct connection will be attempted.
-
proxy
@Nullable() Proxy proxy()
Returns this address's explicitly-specified HTTP proxy, or null to delegate to the proxy selector.
-
sslSocketFactory
@Nullable() SSLSocketFactory sslSocketFactory()
Returns the SSL socket factory, or null if this is not an HTTPS address.
-
hostnameVerifier
@Nullable() HostnameVerifier hostnameVerifier()
Returns the hostname verifier, or null if this is not an HTTPS address.
-
certificatePinner
@Nullable() CertificatePinner certificatePinner()
Returns this address's certificate pinner, or null if this is not an HTTPS address.
-
hashCode
int hashCode()
-
-
-
-