com.squareup.okhttp.internal.http.HttpURLConnectionImpl Java Examples

The following examples show how to use com.squareup.okhttp.internal.http.HttpURLConnectionImpl. 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: HttpResponseCache.java    From cordova-android-chromeview with Apache License 2.0 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #2
Source File: HttpResponseCache.java    From cordova-amazon-fireos with Apache License 2.0 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #3
Source File: HttpResponseCache.java    From cordova-amazon-fireos with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the SSL socket used by {@code httpConnection} for HTTPS, nor null
 * if the connection isn't using HTTPS. Since we permit redirects across
 * protocols (HTTP to HTTPS or vice versa), the implementation type of the
 * connection doesn't necessarily match the implementation type of its HTTP
 * engine.
 */
private SSLSocket getSslSocket(HttpURLConnection httpConnection) {
  HttpEngine engine = httpConnection instanceof HttpsURLConnectionImpl
      ? ((HttpsURLConnectionImpl) httpConnection).getHttpEngine()
      : ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  return engine instanceof HttpsEngine
      ? ((HttpsEngine) engine).getSslSocket()
      : null;
}
 
Example #4
Source File: OkHttpClient.java    From phonegapbootcampsite with MIT License 5 votes vote down vote up
HttpURLConnection open(URL url, Proxy proxy) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  copy.proxy = proxy;

  if (protocol.equals("http")) return new HttpURLConnectionImpl(url, copy);
  if (protocol.equals("https")) return new HttpsURLConnectionImpl(url, copy);
  throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
 
Example #5
Source File: HttpResponseCache.java    From phonegapbootcampsite with MIT License 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #6
Source File: HttpResponseCache.java    From phonegapbootcampsite with MIT License 5 votes vote down vote up
/**
 * Returns the SSL socket used by {@code httpConnection} for HTTPS, nor null
 * if the connection isn't using HTTPS. Since we permit redirects across
 * protocols (HTTP to HTTPS or vice versa), the implementation type of the
 * connection doesn't necessarily match the implementation type of its HTTP
 * engine.
 */
private SSLSocket getSslSocket(HttpURLConnection httpConnection) {
  HttpEngine engine = httpConnection instanceof HttpsURLConnectionImpl
      ? ((HttpsURLConnectionImpl) httpConnection).getHttpEngine()
      : ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  return engine instanceof HttpsEngine
      ? ((HttpsEngine) engine).getSslSocket()
      : null;
}
 
Example #7
Source File: OkHttpClient.java    From CordovaYoutubeVideoPlayer with MIT License 5 votes vote down vote up
HttpURLConnection open(URL url, Proxy proxy) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  copy.proxy = proxy;

  if (protocol.equals("http")) return new HttpURLConnectionImpl(url, copy);
  if (protocol.equals("https")) return new HttpsURLConnectionImpl(url, copy);
  throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
 
Example #8
Source File: HttpResponseCache.java    From CordovaYoutubeVideoPlayer with MIT License 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #9
Source File: HttpResponseCache.java    From CordovaYoutubeVideoPlayer with MIT License 5 votes vote down vote up
/**
 * Returns the SSL socket used by {@code httpConnection} for HTTPS, nor null
 * if the connection isn't using HTTPS. Since we permit redirects across
 * protocols (HTTP to HTTPS or vice versa), the implementation type of the
 * connection doesn't necessarily match the implementation type of its HTTP
 * engine.
 */
private SSLSocket getSslSocket(HttpURLConnection httpConnection) {
  HttpEngine engine = httpConnection instanceof HttpsURLConnectionImpl
      ? ((HttpsURLConnectionImpl) httpConnection).getHttpEngine()
      : ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  return engine instanceof HttpsEngine
      ? ((HttpsEngine) engine).getSslSocket()
      : null;
}
 
Example #10
Source File: OkHttpClient.java    From cordova-android-chromeview with Apache License 2.0 5 votes vote down vote up
public HttpURLConnection open(URL url) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  if (protocol.equals("http")) {
    return new HttpURLConnectionImpl(url, copy, copy.okResponseCache(), copy.failedRoutes);
  } else if (protocol.equals("https")) {
    return new HttpsURLConnectionImpl(url, copy, copy.okResponseCache(), copy.failedRoutes);
  } else {
    throw new IllegalArgumentException("Unexpected protocol: " + protocol);
  }
}
 
Example #11
Source File: OkHttpClient.java    From cordova-amazon-fireos with Apache License 2.0 5 votes vote down vote up
HttpURLConnection open(URL url, Proxy proxy) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  copy.proxy = proxy;

  if (protocol.equals("http")) return new HttpURLConnectionImpl(url, copy);
  if (protocol.equals("https")) return new HttpsURLConnectionImpl(url, copy);
  throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
 
Example #12
Source File: OkHttpClient.java    From wildfly-samples with MIT License 5 votes vote down vote up
HttpURLConnection open(URL url, Proxy proxy) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  copy.proxy = proxy;

  if (protocol.equals("http")) return new HttpURLConnectionImpl(url, copy);
  if (protocol.equals("https")) return new HttpsURLConnectionImpl(url, copy);
  throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
 
Example #13
Source File: HttpResponseCache.java    From wildfly-samples with MIT License 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #14
Source File: HttpResponseCache.java    From wildfly-samples with MIT License 5 votes vote down vote up
/**
 * Returns the SSL socket used by {@code httpConnection} for HTTPS, nor null
 * if the connection isn't using HTTPS. Since we permit redirects across
 * protocols (HTTP to HTTPS or vice versa), the implementation type of the
 * connection doesn't necessarily match the implementation type of its HTTP
 * engine.
 */
private SSLSocket getSslSocket(HttpURLConnection httpConnection) {
  HttpEngine engine = httpConnection instanceof HttpsURLConnectionImpl
      ? ((HttpsURLConnectionImpl) httpConnection).getHttpEngine()
      : ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  return engine instanceof HttpsEngine
      ? ((HttpsEngine) engine).getSslSocket()
      : null;
}
 
Example #15
Source File: OkHttpClient.java    From phonegap-plugin-loading-spinner with Apache License 2.0 5 votes vote down vote up
public HttpURLConnection open(URL url) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  if (protocol.equals("http")) {
    return new HttpURLConnectionImpl(url, copy, copy.okResponseCache(), copy.failedRoutes);
  } else if (protocol.equals("https")) {
    return new HttpsURLConnectionImpl(url, copy, copy.okResponseCache(), copy.failedRoutes);
  } else {
    throw new IllegalArgumentException("Unexpected protocol: " + protocol);
  }
}
 
Example #16
Source File: HttpResponseCache.java    From phonegap-plugin-loading-spinner with Apache License 2.0 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #17
Source File: OkHttpClient.java    From crosswalk-cordova-android with Apache License 2.0 5 votes vote down vote up
HttpURLConnection open(URL url, Proxy proxy) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  copy.proxy = proxy;

  if (protocol.equals("http")) return new HttpURLConnectionImpl(url, copy);
  if (protocol.equals("https")) return new HttpsURLConnectionImpl(url, copy);
  throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
 
Example #18
Source File: HttpResponseCache.java    From crosswalk-cordova-android with Apache License 2.0 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #19
Source File: HttpResponseCache.java    From crosswalk-cordova-android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the SSL socket used by {@code httpConnection} for HTTPS, nor null
 * if the connection isn't using HTTPS. Since we permit redirects across
 * protocols (HTTP to HTTPS or vice versa), the implementation type of the
 * connection doesn't necessarily match the implementation type of its HTTP
 * engine.
 */
private SSLSocket getSslSocket(HttpURLConnection httpConnection) {
  HttpEngine engine = httpConnection instanceof HttpsURLConnectionImpl
      ? ((HttpsURLConnectionImpl) httpConnection).getHttpEngine()
      : ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  return engine instanceof HttpsEngine
      ? ((HttpsEngine) engine).getSslSocket()
      : null;
}
 
Example #20
Source File: OkHttpClient.java    From bluemix-parking-meter with MIT License 5 votes vote down vote up
HttpURLConnection open(URL url, Proxy proxy) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  copy.proxy = proxy;

  if (protocol.equals("http")) return new HttpURLConnectionImpl(url, copy);
  if (protocol.equals("https")) return new HttpsURLConnectionImpl(url, copy);
  throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
 
Example #21
Source File: HttpResponseCache.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #22
Source File: HttpResponseCache.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
/**
 * Returns the SSL socket used by {@code httpConnection} for HTTPS, nor null
 * if the connection isn't using HTTPS. Since we permit redirects across
 * protocols (HTTP to HTTPS or vice versa), the implementation type of the
 * connection doesn't necessarily match the implementation type of its HTTP
 * engine.
 */
private SSLSocket getSslSocket(HttpURLConnection httpConnection) {
  HttpEngine engine = httpConnection instanceof HttpsURLConnectionImpl
      ? ((HttpsURLConnectionImpl) httpConnection).getHttpEngine()
      : ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  return engine instanceof HttpsEngine
      ? ((HttpsEngine) engine).getSslSocket()
      : null;
}
 
Example #23
Source File: OkHttpClient.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
HttpURLConnection open(URL url, Proxy proxy) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  copy.proxy = proxy;

  if (protocol.equals("http")) return new HttpURLConnectionImpl(url, copy);
  if (protocol.equals("https")) return new HttpsURLConnectionImpl(url, copy);
  throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
 
Example #24
Source File: HttpResponseCache.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #25
Source File: HttpResponseCache.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
/**
 * Returns the SSL socket used by {@code httpConnection} for HTTPS, nor null
 * if the connection isn't using HTTPS. Since we permit redirects across
 * protocols (HTTP to HTTPS or vice versa), the implementation type of the
 * connection doesn't necessarily match the implementation type of its HTTP
 * engine.
 */
private SSLSocket getSslSocket(HttpURLConnection httpConnection) {
  HttpEngine engine = httpConnection instanceof HttpsURLConnectionImpl
      ? ((HttpsURLConnectionImpl) httpConnection).getHttpEngine()
      : ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  return engine instanceof HttpsEngine
      ? ((HttpsEngine) engine).getSslSocket()
      : null;
}
 
Example #26
Source File: OkHttpClient.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
HttpURLConnection open(URL url, Proxy proxy) {
    String protocol = url.getProtocol();
    OkHttpClient copy = copyWithDefaults();
    copy.proxy = proxy;

    if (protocol.equals("http"))
        return new HttpURLConnectionImpl(url, copy);
    if (protocol.equals("https"))
        return new HttpsURLConnectionImpl(url, copy);
    throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
 
Example #27
Source File: HttpResponseCache.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
    if (httpConnection instanceof HttpURLConnectionImpl) {
        return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
    } else if (httpConnection instanceof HttpsURLConnectionImpl) {
        return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
    } else {
        return null;
    }
}
 
Example #28
Source File: OkHttpClient.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
HttpURLConnection open(URL url, Proxy proxy) {
  String protocol = url.getProtocol();
  OkHttpClient copy = copyWithDefaults();
  copy.proxy = proxy;

  if (protocol.equals("http")) return new HttpURLConnectionImpl(url, copy);
  if (protocol.equals("https")) return new HttpsURLConnectionImpl(url, copy);
  throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
 
Example #29
Source File: HttpResponseCache.java    From bluemix-parking-meter with MIT License 5 votes vote down vote up
private HttpEngine getHttpEngine(URLConnection httpConnection) {
  if (httpConnection instanceof HttpURLConnectionImpl) {
    return ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  } else if (httpConnection instanceof HttpsURLConnectionImpl) {
    return ((HttpsURLConnectionImpl) httpConnection).getHttpEngine();
  } else {
    return null;
  }
}
 
Example #30
Source File: HttpResponseCache.java    From bluemix-parking-meter with MIT License 5 votes vote down vote up
/**
 * Returns the SSL socket used by {@code httpConnection} for HTTPS, nor null
 * if the connection isn't using HTTPS. Since we permit redirects across
 * protocols (HTTP to HTTPS or vice versa), the implementation type of the
 * connection doesn't necessarily match the implementation type of its HTTP
 * engine.
 */
private SSLSocket getSslSocket(HttpURLConnection httpConnection) {
  HttpEngine engine = httpConnection instanceof HttpsURLConnectionImpl
      ? ((HttpsURLConnectionImpl) httpConnection).getHttpEngine()
      : ((HttpURLConnectionImpl) httpConnection).getHttpEngine();
  return engine instanceof HttpsEngine
      ? ((HttpsEngine) engine).getSslSocket()
      : null;
}