Commit 7040bcee authored by yanzg's avatar yanzg

Merge remote-tracking branch 'origin/master'

parents 0004b5a5 798e61ee
......@@ -10,10 +10,13 @@ import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.params.CoreConnectionPNames;
import org.apache.http.util.EntityUtils;
import sun.plugin.dom.core.CoreConstants;
import java.io.*;
import java.net.HttpURLConnection;
......@@ -441,6 +444,14 @@ public class HttpHelper {
post.addHeader("Content-Type", mediaType);
post.addHeader("Accept", "application/json");
post.setEntity(entity);
RequestConfig config = RequestConfig.custom()
.setConnectionRequestTimeout(1000)
//服务端相应超时
.setSocketTimeout(1000)
//建立socket链接超时
.setConnectTimeout(3000)
.build();
post.setConfig(config);
String var8;
try {
HttpClient client = HttpClientBuilder.create().build();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment