Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion server/src/com/mirth/connect/client/core/ServerConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.StatusLine;
Expand Down Expand Up @@ -134,7 +135,21 @@ public ServerConnection(int timeout, String[] httpsProtocols, String[] httpsCiph

cookieStore = new BasicCookieStore();
socketConfig = SocketConfig.custom().setSoTimeout(timeout).build();
requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(timeout).build();

RequestConfig.Builder requestConfigBuilder = RequestConfig.custom()
.setConnectTimeout(CONNECT_TIMEOUT)
.setSocketTimeout(timeout);

// If HTTP Proxy is set, configure it
String httpProxyHost = System.getProperty("mirthApi.http.proxyHost");
if (allowHTTP && StringUtils.isNotBlank(httpProxyHost)) {
String httpProxyPort = System.getProperty("mirthApi.http.proxyPort");
int proxyPort = StringUtils.isNotBlank(httpProxyPort) ? Integer.parseInt(httpProxyPort) : 8888;
logger.info("Using API HTTP Proxy {}:{}", httpProxyHost, proxyPort);
requestConfigBuilder.setProxy(new HttpHost(httpProxyHost, proxyPort));
}

requestConfig = requestConfigBuilder.build();
keepAliveStrategy = new CustomKeepAliveStrategy();

createClient();
Expand Down