本文整理汇总了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);
}
示例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;
}
}
示例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;
}