You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Finally I found OkUrlFactory and be able to use it to create a HttpUrlConnection:
/** * A {@link HttpRequest.ConnectionFactory connection factory} which uses OkHttp. * <p/> * Call {@link HttpRequest#setConnectionFactory(HttpRequest.ConnectionFactory)} with an instance of * this class to enable. */publicclassOkConnectionFactoryimplementsHttpRequest.ConnectionFactory {
privatefinalOkHttpClientclient;
privateOkUrlFactoryfactory;
publicOkConnectionFactory() {
this(newOkHttpClient());
}
publicOkConnectionFactory(OkHttpClientclient) {
if (client == null) {
thrownewNullPointerException("Client must not be null.");
}
this.client = client;
factory = newOkUrlFactory(client);
}
publicHttpURLConnectioncreate(URLurl) throwsIOException {
returnfactory.open(url);
}
publicHttpURLConnectioncreate(URLurl, Proxyproxy) throwsIOException {
thrownewUnsupportedOperationException(
"Per-connection proxy is not supported. Use OkHttpClient's setProxy instead.");
}
}
Do you have any example of setting up
http-request
withokhttp 2.0
?The text was updated successfully, but these errors were encountered: