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


Java HttpURLConnectionImpl类代码示例

本文整理汇总了Java中com.squareup.okhttp.internal.http.HttpURLConnectionImpl的典型用法代码示例。如果您正苦于以下问题:Java HttpURLConnectionImpl类的具体用法?Java HttpURLConnectionImpl怎么用?Java HttpURLConnectionImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HttpURLConnectionImpl类属于com.squareup.okhttp.internal.http包,在下文中一共展示了HttpURLConnectionImpl类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: open

import com.squareup.okhttp.internal.http.HttpURLConnectionImpl; //导入依赖的package包/类
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);
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:10,代码来源:OkHttpClient.java

示例2: getHttpEngine

import com.squareup.okhttp.internal.http.HttpURLConnectionImpl; //导入依赖的package包/类
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;
  }
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:10,代码来源:HttpResponseCache.java

示例3: getSslSocket

import com.squareup.okhttp.internal.http.HttpURLConnectionImpl; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:16,代码来源:HttpResponseCache.java


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