mirror of
https://github.com/luoye663/e5.git
synced 2024-12-26 11:48:50 +00:00
修改http超时设置
This commit is contained in:
parent
e920a3d3fa
commit
5250ddb429
@ -18,16 +18,16 @@ import okhttp3.RequestBody;
|
|||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
public class OkHttpClientUtil {
|
public class OkHttpClientUtil {
|
||||||
private static int connTimeOut = 5;
|
private static int connTimeOut = 5 * 1000;
|
||||||
private static int readTimeOut = 20;
|
private static int readTimeOut = 20 * 1000;
|
||||||
private static int writeTimeOut = 10;
|
private static int writeTimeOut = 10 * 1000;
|
||||||
public static OkHttpClient client = null;
|
public static OkHttpClient client = null;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
client = new OkHttpClient.Builder()
|
client = new OkHttpClient.Builder()
|
||||||
.connectTimeout(5L, TimeUnit.SECONDS)
|
.connectTimeout(connTimeOut, TimeUnit.SECONDS)
|
||||||
.readTimeout(20L, TimeUnit.SECONDS)
|
.readTimeout(readTimeOut, TimeUnit.SECONDS)
|
||||||
.writeTimeout(10L, TimeUnit.SECONDS)
|
.writeTimeout(writeTimeOut, TimeUnit.SECONDS)
|
||||||
.retryOnConnectionFailure(true)
|
.retryOnConnectionFailure(true)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user