當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。