use of okhttp3.Address in project okhttp by square.
the class RouteSelector method next.
public Route next() throws IOException {
// Compute the next route to attempt.
if (!hasNextInetSocketAddress()) {
if (!hasNextProxy()) {
if (!hasNextPostponed()) {
throw new NoSuchElementException();
}
return nextPostponed();
}
lastProxy = nextProxy();
}
lastInetSocketAddress = nextInetSocketAddress();
Route route = new Route(address, lastProxy, lastInetSocketAddress);
if (routeDatabase.shouldPostpone(route)) {
postponedRoutes.add(route);
// We will only recurse in order to skip previously failed routes. They will be tried last.
return next();
}
return route;
}
use of okhttp3.Address in project okhttp by square.
the class RetryAndFollowUpInterceptor method createAddress.
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());
}
use of okhttp3.Address in project u2020 by JakeWharton.
the class DebugView method showNewNetworkProxyDialog.
private void showNewNetworkProxyDialog(final ProxyAdapter proxyAdapter) {
final int originalSelection = networkProxyAddress.isSet() ? ProxyAdapter.PROXY : ProxyAdapter.NONE;
View view = LayoutInflater.from(app).inflate(R.layout.debug_drawer_network_proxy, null);
final EditText hostView = findById(view, R.id.debug_drawer_network_proxy_host);
if (networkProxyAddress.isSet()) {
String host = networkProxyAddress.get().getHostName();
// Set the current host.
hostView.setText(host);
// Pre-select it for editing.
hostView.setSelection(0, host.length());
// Show the keyboard. Post this to the next frame when the dialog has been attached.
hostView.post(() -> Keyboards.showKeyboard(hostView));
}
//
new AlertDialog.Builder(getContext()).setTitle("Set Network Proxy").setView(view).setNegativeButton("Cancel", (dialog, i) -> {
networkProxyView.setSelection(originalSelection);
dialog.cancel();
}).setPositiveButton("Use", (dialog, i) -> {
String in = hostView.getText().toString();
InetSocketAddress address = InetSocketAddressPreferenceAdapter.parse(in);
if (address != null) {
networkProxyAddress.set(address);
// Force a restart to re-initialize the app with the new proxy.
ProcessPhoenix.triggerRebirth(getContext());
} else {
networkProxyView.setSelection(originalSelection);
}
}).setOnCancelListener(dialogInterface -> networkProxyView.setSelection(originalSelection)).show();
}
use of okhttp3.Address in project ORCID-Source by ORCID.
the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(Addresses addresses) {
if (addresses != null && addresses.getAddress() != null && !addresses.getAddress().isEmpty()) {
LastModifiedDate latest = null;
for (Address address : addresses.getAddress()) {
if (address.getLastModifiedDate() != null && address.getLastModifiedDate().after(latest)) {
latest = address.getLastModifiedDate();
}
}
addresses.setLastModifiedDate(latest);
}
}
use of okhttp3.Address in project ORCID-Source by ORCID.
the class Api2_0_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(Addresses addresses) {
if (addresses != null && addresses.getAddress() != null && !addresses.getAddress().isEmpty()) {
LastModifiedDate latest = null;
for (Address address : addresses.getAddress()) {
if (address.getLastModifiedDate() != null && address.getLastModifiedDate().after(latest)) {
latest = address.getLastModifiedDate();
}
}
addresses.setLastModifiedDate(latest);
}
}
Aggregations