Click Here To show my issue,I just want set per request timeout and other paramters, so just use:
<!-- language: lang-java -->
private static final OkHttpClient globalOkHttpClient = new OkHttpClient.Builder().build();
private static final OkHttpClient otherOkHttpClient10 = globalOkHttpClient.newBuilder()
.connectTimeout(10,TimeUnit.SECONDS)
.build();
private static final OkHttpClient otherOkHttpClient20 = globalOkHttpClient.newBuilder()
.connectTimeout(20,TimeUnit.SECONDS)
.build();
But that may not reusing a single OkHttp
instance? So,I just want to ask?How to set OkHttpClient
timeout Per Request
.
My OkHttp3
maven dependency:
<!-- language: lang-xml -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.9.0</version>
</dependency>