public int getPort() { return url.port(); }
public int getDefaultPort() { return url.port(); }
boolean equalsNonHost(Address that) { return this.dns.equals(that.dns) && this.proxyAuthenticator.equals(that.proxyAuthenticator) && this.protocols.equals(that.protocols) && this.connectionSpecs.equals(that.connectionSpecs) && this.proxySelector.equals(that.proxySelector) && Objects.equals(this.proxy, that.proxy) && Objects.equals(this.sslSocketFactory, that.sslSocketFactory) && Objects.equals(this.hostnameVerifier, that.hostnameVerifier) && Objects.equals(this.certificatePinner, that.certificatePinner) && this.url().port() == that.url().port(); }
@Override public String toString() { StringBuilder result = new StringBuilder() .append("Address{") .append(url.host()).append(":").append(url.port()); if (proxy != null) { result.append(", proxy=").append(proxy); } else { result.append(", proxySelector=").append(proxySelector); } result.append("}"); return result.toString(); } }
/** * Returns true if an HTTP request for {@code followUp} can reuse the connection used by this * engine. */ private boolean sameConnection(Response response, HttpUrl followUp) { HttpUrl url = response.request().url(); return url.host().equals(followUp.host()) && url.port() == followUp.port() && url.scheme().equals(followUp.scheme()); } }
boolean equalsNonHost(Address that) { return this.dns.equals(that.dns) && this.proxyAuthenticator.equals(that.proxyAuthenticator) && this.protocols.equals(that.protocols) && this.connectionSpecs.equals(that.connectionSpecs) && this.proxySelector.equals(that.proxySelector) && Objects.equals(this.proxy, that.proxy) && Objects.equals(this.sslSocketFactory, that.sslSocketFactory) && Objects.equals(this.hostnameVerifier, that.hostnameVerifier) && Objects.equals(this.certificatePinner, that.certificatePinner) && this.url().port() == that.url().port(); }
@Override public String toString() { StringBuilder result = new StringBuilder() .append("Address{") .append(url.host()).append(":").append(url.port()); if (proxy != null) { result.append(", proxy=").append(proxy); } else { result.append(", proxySelector=").append(proxySelector); } result.append("}"); return result.toString(); } }
/** * Returns true if an HTTP request for {@code followUp} can reuse the connection used by this * engine. */ private boolean sameConnection(Response response, HttpUrl followUp) { HttpUrl url = response.request().url(); return url.host().equals(followUp.host()) && url.port() == followUp.port() && url.scheme().equals(followUp.scheme()); } }
public boolean supportsUrl(HttpUrl url) { if (url.port() != route.address().url().port()) { return false; // Port mismatch. } if (!url.host().equals(route.address().url().host())) { // We have a host mismatch. But if the certificate matches, we're still good. return handshake != null && OkHostnameVerifier.INSTANCE.verify( url.host(), (X509Certificate) handshake.peerCertificates().get(0)); } return true; // Success. The URL is supported. }
if (proxy.type() == Proxy.Type.DIRECT || proxy.type() == Proxy.Type.SOCKS) { socketHost = address.url().host(); socketPort = address.url().port(); } else { SocketAddress proxyAddress = proxy.address();
public boolean supportsUrl(HttpUrl url) { if (url.port() != route.address().url().port()) { return false; // Port mismatch. } if (!url.host().equals(route.address().url().host())) { // We have a host mismatch. But if the certificate matches, we're still good. return handshake != null && OkHostnameVerifier.INSTANCE.verify( url.host(), (X509Certificate) handshake.peerCertificates().get(0)); } return true; // Success. The URL is supported. }
} else { auth = java.net.Authenticator.requestPasswordAuthentication( url.host(), getConnectToInetAddress(proxy, url), url.port(), url.scheme(), challenge.realm(), challenge.scheme(), url.url(), RequestorType.SERVER);
if (proxy.type() == Proxy.Type.DIRECT || proxy.type() == Proxy.Type.SOCKS) { socketHost = address.url().host(); socketPort = address.url().port(); } else { SocketAddress proxyAddress = proxy.address();
@Override public String toString() { return "Connection{" + route.address().url().host() + ":" + route.address().url().port() + ", proxy=" + route.proxy() + " hostAddress=" + route.socketAddress() + " cipherSuite=" + (handshake != null ? handshake.cipherSuite() : "none") + " protocol=" + protocol + '}'; } }
private Address createAddress(HttpUrl url) { SSLSocketFactory sslSocketFactory = null; HostnameVerifier hostnameVerifier = null; CertificatePinner certificatePinner = null; if (url.isHttps()) { sslSocketFactory = client.sslSocketFactory(); hostnameVerifier = client.hostnameVerifier(); certificatePinner = client.certificatePinner(); } return new Address(url.host(), url.port(), client.dns(), client.socketFactory(), sslSocketFactory, hostnameVerifier, certificatePinner, client.proxyAuthenticator(), client.proxy(), client.protocols(), client.connectionSpecs(), client.proxySelector()); }
rawSocket, address.url().host(), address.url().port(), true /* autoClose */);
@Override public String toString() { return "Connection{" + route.address().url().host() + ":" + route.address().url().port() + ", proxy=" + route.proxy() + " hostAddress=" + route.socketAddress() + " cipherSuite=" + (handshake != null ? handshake.cipherSuite() : "none") + " protocol=" + protocol + '}'; } }
private Address createAddress(HttpUrl url) { SSLSocketFactory sslSocketFactory = null; HostnameVerifier hostnameVerifier = null; CertificatePinner certificatePinner = null; if (url.isHttps()) { sslSocketFactory = client.sslSocketFactory(); hostnameVerifier = client.hostnameVerifier(); certificatePinner = client.certificatePinner(); } return new Address(url.host(), url.port(), client.dns(), client.socketFactory(), sslSocketFactory, hostnameVerifier, certificatePinner, client.proxyAuthenticator(), client.proxy(), client.protocols(), client.connectionSpecs(), client.proxySelector()); }