use of okhttp3.Protocol in project NoHttp by yanzhenjie.
the class URLConnectionFactory method open.
/**
* Open url.
*
* @param url {@link URL}.
* @param proxy {@link Proxy}.
* @return {@link HttpURLConnection}.
*/
public HttpURLConnection open(URL url, Proxy proxy) {
OkHttpClient copy = mClient.newBuilder().proxy(proxy).build();
String protocol = url.getProtocol();
if (protocol.equals("http"))
return new OkHttpURLConnection(url, copy);
if (protocol.equals("https"))
return new OkHttpsURLConnection(url, copy);
throw new IllegalArgumentException("Unexpected protocol: " + protocol);
}
use of okhttp3.Protocol in project Rocket.Chat.Android by RocketChat.
the class DefaultServerPolicyApi method getApiInfo.
private Flowable<Response<JSONObject>> getApiInfo(@NonNull String protocol) {
return Flowable.create(responseEmitter -> {
final Call call = client.newCall(createRequest(protocol));
call.enqueue(getOkHttpCallback(responseEmitter, protocol));
responseEmitter.setCancellable(call::cancel);
}, BackpressureStrategy.LATEST);
}
Aggregations