Skip to content

//okhttp/okhttp3/Address

Address

[jvm]\ class Address(uriHost: String, uriPort: Int, val dns: Dns, val socketFactory: SocketFactory, val sslSocketFactory: SSLSocketFactory?, val hostnameVerifier: HostnameVerifier?, val certificatePinner: CertificatePinner?, val proxyAuthenticator: Authenticator, val proxy: Proxy?, protocols: List<Protocol>, connectionSpecs: List<ConnectionSpec>, val proxySelector: ProxySelector)

A 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 Address may also share the same Connection.

Constructors

Address [jvm]
fun Address(uriHost: String, uriPort: Int, dns: Dns, socketFactory: SocketFactory, sslSocketFactory: SSLSocketFactory?, hostnameVerifier: HostnameVerifier?, certificatePinner: CertificatePinner?, proxyAuthenticator: Authenticator, proxy: Proxy?, protocols: List<Protocol>, connectionSpecs: List<ConnectionSpec>, proxySelector: ProxySelector)

Functions

Name Summary
equals [jvm]
open operator override fun equals(other: Any?): Boolean
hashCode [jvm]
open override fun hashCode(): Int
toString [jvm]
open override fun toString(): String

Properties

Name Summary
certificatePinner [jvm]
@get:JvmName(name = "certificatePinner")
val certificatePinner: CertificatePinner?
Returns this address’s certificate pinner, or null if this is not an HTTPS address.
connectionSpecs [jvm]
@get:JvmName(name = "connectionSpecs")
val connectionSpecs: List<ConnectionSpec>
dns [jvm]
@get:JvmName(name = "dns")
val dns: Dns
Returns the service that will be used to resolve IP addresses for hostnames.
hostnameVerifier [jvm]
@get:JvmName(name = "hostnameVerifier")
val hostnameVerifier: HostnameVerifier?
Returns the hostname verifier, or null if this is not an HTTPS address.
protocols [jvm]
@get:JvmName(name = "protocols")
val protocols: List<Protocol>
The protocols the client supports. This method always returns a non-null list that contains minimally Protocol.HTTP_1_1.
proxy [jvm]
@get:JvmName(name = "proxy")
val proxy: Proxy?
Returns this address’s explicitly-specified HTTP proxy, or null to delegate to the proxy selector.
proxyAuthenticator [jvm]
@get:JvmName(name = "proxyAuthenticator")
val proxyAuthenticator: Authenticator
Returns the client’s proxy authenticator.
proxySelector [jvm]
@get:JvmName(name = "proxySelector")
val proxySelector: ProxySelector
Returns this address’s proxy selector. Only used if the proxy is null. If none of this selector’s proxies are reachable, a direct connection will be attempted.
socketFactory [jvm]
@get:JvmName(name = "socketFactory")
val socketFactory: SocketFactory
Returns the socket factory for new connections.
sslSocketFactory [jvm]
@get:JvmName(name = "sslSocketFactory")
val sslSocketFactory: SSLSocketFactory?
Returns the SSL socket factory, or null if this is not an HTTPS address.
url [jvm]
@get:JvmName(name = "url")
val url: HttpUrl
Returns a URL with the hostname and port of the origin server. The path, query, and fragment of this URL are always empty, since they are not significant for planning a route.