Java Code Examples for com.squareup.okhttp.Connection#getRoute()

The following examples show how to use com.squareup.okhttp.Connection#getRoute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RouteSelector.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 2
Source File: RouteSelector.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: RouteSelector.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: RouteSelector.java    From bluemix-parking-meter with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 5
Source File: RouteSelector.java    From reader with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 6
Source File: RouteSelector.java    From reader with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 7
Source File: RouteSelector.java    From cordova-amazon-fireos with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 8
Source File: RouteSelector.java    From phonegapbootcampsite with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 9
Source File: RouteSelector.java    From CordovaYoutubeVideoPlayer with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 10
Source File: RouteSelector.java    From cordova-android-chromeview with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
  }

  failedRoutes.add(failedRoute);
  if (!(failure instanceof SSLHandshakeException)) {
    // If the problem was not related to SSL then it will also fail with
    // a different Tls mode therefore we can be proactive about it.
    failedRoutes.add(failedRoute.flipTlsMode());
  }
}
 
Example 11
Source File: RouteSelector.java    From wildfly-samples with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 12
Source File: RouteSelector.java    From phonegap-plugin-loading-spinner with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
  }

  failedRoutes.add(failedRoute);
  if (!(failure instanceof SSLHandshakeException)) {
    // If the problem was not related to SSL then it will also fail with
    // a different Tls mode therefore we can be proactive about it.
    failedRoutes.add(failedRoute.flipTlsMode());
  }
}
 
Example 13
Source File: RouteSelector.java    From crosswalk-cordova-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}