本文整理汇总了Java中com.squareup.okhttp.Route类的典型用法代码示例。如果您正苦于以下问题:Java Route类的具体用法?Java Route怎么用?Java Route使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Route类属于com.squareup.okhttp包,在下文中一共展示了Route类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
import com.squareup.okhttp.Route; //导入依赖的package包/类
public Route next() throws IOException {
if (!hasNextInetSocketAddress()) {
if (hasNextProxy()) {
this.lastProxy = nextProxy();
} else if (hasNextPostponed()) {
return nextPostponed();
} else {
throw new NoSuchElementException();
}
}
this.lastInetSocketAddress = nextInetSocketAddress();
Route route = new Route(this.address, this.lastProxy, this.lastInetSocketAddress);
if (!this.routeDatabase.shouldPostpone(route)) {
return route;
}
this.postponedRoutes.add(route);
return next();
}
示例2: connectFailed
import com.squareup.okhttp.Route; //导入依赖的package包/类
public final void connectFailed(Connection paramConnection, IOException paramIOException)
{
if (Internal.instance.recycleCount(paramConnection) > 0) {}
for (;;)
{
return;
Route localRoute1 = paramConnection.route;
if ((localRoute1.proxy.type() != Proxy.Type.DIRECT) && (this.address.proxySelector != null)) {
this.address.proxySelector.connectFailed(this.uri, localRoute1.proxy.address(), paramIOException);
}
this.routeDatabase.failed(localRoute1);
if ((!(paramIOException instanceof SSLHandshakeException)) && (!(paramIOException instanceof SSLProtocolException))) {
while (this.nextSpecIndex < this.connectionSpecs.size())
{
List localList = this.connectionSpecs;
int i = this.nextSpecIndex;
this.nextSpecIndex = (i + 1);
ConnectionSpec localConnectionSpec = (ConnectionSpec)localList.get(i);
boolean bool = shouldSendTlsFallbackIndicator(localConnectionSpec);
Route localRoute2 = new Route(this.address, this.lastProxy, this.lastInetSocketAddress, localConnectionSpec, bool);
this.routeDatabase.failed(localRoute2);
}
}
}
}
示例3: connectFailed
import com.squareup.okhttp.Route; //导入依赖的package包/类
public void connectFailed(Route failedRoute, IOException failure) {
if (!(failedRoute.getProxy().type() == Type.DIRECT || this.address.getProxySelector() ==
null)) {
this.address.getProxySelector().connectFailed(this.address.url().uri(), failedRoute
.getProxy().address(), failure);
}
this.routeDatabase.failed(failedRoute);
}
示例4: RouteSelector
import com.squareup.okhttp.Route; //导入依赖的package包/类
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
Dns dns, RouteDatabase routeDatabase) {
this.address = address;
this.uri = uri;
this.proxySelector = proxySelector;
this.pool = pool;
this.dns = dns;
this.routeDatabase = routeDatabase;
this.postponedRoutes = new LinkedList<Route>();
resetNextProxy(uri, address.getProxy());
}
示例5: next
import com.squareup.okhttp.Route; //导入依赖的package包/类
/**
* Returns the next route address to attempt.
*
* @throws NoSuchElementException if there are no more routes to attempt.
*/
public Connection next(String method) throws IOException {
// Always prefer pooled connections over new connections.
for (Connection pooled; (pooled = pool.get(address)) != null; ) {
if (method.equals("GET") || pooled.isReadable()) return pooled;
pooled.close();
}
// Compute the next route to attempt.
if (!hasNextTlsMode()) {
if (!hasNextInetSocketAddress()) {
if (!hasNextProxy()) {
if (!hasNextPostponed()) {
throw new NoSuchElementException();
}
return new Connection(nextPostponed());
}
lastProxy = nextProxy();
resetNextInetSocketAddress(lastProxy);
}
lastInetSocketAddress = nextInetSocketAddress();
resetNextTlsMode();
}
boolean modernTls = nextTlsMode() == TLS_MODE_MODERN;
Route route = new Route(address, lastProxy, lastInetSocketAddress, modernTls);
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(method);
}
return new Connection(route);
}
示例6: connectFailed
import com.squareup.okhttp.Route; //导入依赖的package包/类
/**
* Clients should invoke this method when they encounter a connectivity
* failure on a connection returned by this route selector.
*/
public void connectFailed(Connection connection, IOException failure) {
Route failedRoute = connection.getRoute();
if (failedRoute.getProxy().type() != Proxy.Type.DIRECT && proxySelector != null) {
// Tell the proxy selector when we fail to connect on a fresh connection.
proxySelector.connectFailed(uri, failedRoute.getProxy().address(), failure);
}
routeDatabase.failed(failedRoute, failure);
}
示例7: connected
import com.squareup.okhttp.Route; //导入依赖的package包/类
public final void connected(Route paramRoute)
{
try
{
this.failedRoutes.remove(paramRoute);
return;
}
finally
{
localObject = finally;
throw localObject;
}
}
示例8: failed
import com.squareup.okhttp.Route; //导入依赖的package包/类
public final void failed(Route paramRoute)
{
try
{
this.failedRoutes.add(paramRoute);
return;
}
finally
{
localObject = finally;
throw localObject;
}
}
示例9: shouldPostpone
import com.squareup.okhttp.Route; //导入依赖的package包/类
public final boolean shouldPostpone(Route paramRoute)
{
try
{
boolean bool = this.failedRoutes.contains(paramRoute);
return bool;
}
finally
{
localObject = finally;
throw localObject;
}
}