145 lines
5.3 KiB
Java
145 lines
5.3 KiB
Java
package okhttp3;
|
|
|
|
import java.net.Proxy;
|
|
import java.net.ProxySelector;
|
|
import java.util.List;
|
|
import javax.net.SocketFactory;
|
|
import javax.net.ssl.HostnameVerifier;
|
|
import javax.net.ssl.SSLSocketFactory;
|
|
import okhttp3.HttpUrl;
|
|
import okhttp3.internal.Util;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class Address {
|
|
final CertificatePinner certificatePinner;
|
|
final List<ConnectionSpec> connectionSpecs;
|
|
final Dns dns;
|
|
final HostnameVerifier hostnameVerifier;
|
|
final List<Protocol> protocols;
|
|
final Proxy proxy;
|
|
final Authenticator proxyAuthenticator;
|
|
final ProxySelector proxySelector;
|
|
final SocketFactory socketFactory;
|
|
final SSLSocketFactory sslSocketFactory;
|
|
final HttpUrl url;
|
|
|
|
public Address(String str, int i, Dns dns, SocketFactory socketFactory, SSLSocketFactory sSLSocketFactory, HostnameVerifier hostnameVerifier, CertificatePinner certificatePinner, Authenticator authenticator, Proxy proxy, List<Protocol> list, List<ConnectionSpec> list2, ProxySelector proxySelector) {
|
|
this.url = new HttpUrl.Builder().scheme(sSLSocketFactory != null ? "https" : "http").host(str).port(i).build();
|
|
if (dns == null) {
|
|
throw new NullPointerException("dns == null");
|
|
}
|
|
this.dns = dns;
|
|
if (socketFactory == null) {
|
|
throw new NullPointerException("socketFactory == null");
|
|
}
|
|
this.socketFactory = socketFactory;
|
|
if (authenticator == null) {
|
|
throw new NullPointerException("proxyAuthenticator == null");
|
|
}
|
|
this.proxyAuthenticator = authenticator;
|
|
if (list == null) {
|
|
throw new NullPointerException("protocols == null");
|
|
}
|
|
this.protocols = Util.immutableList(list);
|
|
if (list2 == null) {
|
|
throw new NullPointerException("connectionSpecs == null");
|
|
}
|
|
this.connectionSpecs = Util.immutableList(list2);
|
|
if (proxySelector == null) {
|
|
throw new NullPointerException("proxySelector == null");
|
|
}
|
|
this.proxySelector = proxySelector;
|
|
this.proxy = proxy;
|
|
this.sslSocketFactory = sSLSocketFactory;
|
|
this.hostnameVerifier = hostnameVerifier;
|
|
this.certificatePinner = certificatePinner;
|
|
}
|
|
|
|
public CertificatePinner certificatePinner() {
|
|
return this.certificatePinner;
|
|
}
|
|
|
|
public List<ConnectionSpec> connectionSpecs() {
|
|
return this.connectionSpecs;
|
|
}
|
|
|
|
public Dns dns() {
|
|
return this.dns;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (obj instanceof Address) {
|
|
Address address = (Address) obj;
|
|
if (this.url.equals(address.url) && equalsNonHost(address)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
boolean equalsNonHost(Address address) {
|
|
return this.dns.equals(address.dns) && this.proxyAuthenticator.equals(address.proxyAuthenticator) && this.protocols.equals(address.protocols) && this.connectionSpecs.equals(address.connectionSpecs) && this.proxySelector.equals(address.proxySelector) && Util.equal(this.proxy, address.proxy) && Util.equal(this.sslSocketFactory, address.sslSocketFactory) && Util.equal(this.hostnameVerifier, address.hostnameVerifier) && Util.equal(this.certificatePinner, address.certificatePinner) && url().port() == address.url().port();
|
|
}
|
|
|
|
public int hashCode() {
|
|
int hashCode = (((((((((((527 + this.url.hashCode()) * 31) + this.dns.hashCode()) * 31) + this.proxyAuthenticator.hashCode()) * 31) + this.protocols.hashCode()) * 31) + this.connectionSpecs.hashCode()) * 31) + this.proxySelector.hashCode()) * 31;
|
|
Proxy proxy = this.proxy;
|
|
int hashCode2 = (hashCode + (proxy != null ? proxy.hashCode() : 0)) * 31;
|
|
SSLSocketFactory sSLSocketFactory = this.sslSocketFactory;
|
|
int hashCode3 = (hashCode2 + (sSLSocketFactory != null ? sSLSocketFactory.hashCode() : 0)) * 31;
|
|
HostnameVerifier hostnameVerifier = this.hostnameVerifier;
|
|
int hashCode4 = (hashCode3 + (hostnameVerifier != null ? hostnameVerifier.hashCode() : 0)) * 31;
|
|
CertificatePinner certificatePinner = this.certificatePinner;
|
|
return hashCode4 + (certificatePinner != null ? certificatePinner.hashCode() : 0);
|
|
}
|
|
|
|
public HostnameVerifier hostnameVerifier() {
|
|
return this.hostnameVerifier;
|
|
}
|
|
|
|
public List<Protocol> protocols() {
|
|
return this.protocols;
|
|
}
|
|
|
|
public Proxy proxy() {
|
|
return this.proxy;
|
|
}
|
|
|
|
public Authenticator proxyAuthenticator() {
|
|
return this.proxyAuthenticator;
|
|
}
|
|
|
|
public ProxySelector proxySelector() {
|
|
return this.proxySelector;
|
|
}
|
|
|
|
public SocketFactory socketFactory() {
|
|
return this.socketFactory;
|
|
}
|
|
|
|
public SSLSocketFactory sslSocketFactory() {
|
|
return this.sslSocketFactory;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Address{");
|
|
sb.append(this.url.host());
|
|
sb.append(":");
|
|
sb.append(this.url.port());
|
|
if (this.proxy != null) {
|
|
sb.append(", proxy=");
|
|
sb.append(this.proxy);
|
|
} else {
|
|
sb.append(", proxySelector=");
|
|
sb.append(this.proxySelector);
|
|
}
|
|
sb.append("}");
|
|
return sb.toString();
|
|
}
|
|
|
|
public HttpUrl url() {
|
|
return this.url;
|
|
}
|
|
}
|