当前位置: 首页>>代码示例>>Java>>正文


Java Route类代码示例

本文整理汇总了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();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:RouteSelector.java

示例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);
      }
    }
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:26,代码来源:RouteSelector.java

示例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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:RouteSelector.java

示例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());
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:13,代码来源:RouteSelector.java

示例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);
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:40,代码来源:RouteSelector.java

示例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);
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:14,代码来源:RouteSelector.java

示例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;
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:14,代码来源:RouteDatabase.java

示例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;
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:14,代码来源:RouteDatabase.java

示例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;
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:14,代码来源:RouteDatabase.java


注:本文中的com.squareup.okhttp.Route类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。