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