From d50072780979d9dec96ac6452beba82083899f52 Mon Sep 17 00:00:00 2001 From: Arun Bhalla Date: Thu, 23 Feb 2017 22:14:01 -0800 Subject: [PATCH] Add configured timeouts to EventProcessor --- .../java/com/launchdarkly/client/EventProcessor.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/launchdarkly/client/EventProcessor.java b/src/main/java/com/launchdarkly/client/EventProcessor.java index 8659f4ce3..a578e771c 100644 --- a/src/main/java/com/launchdarkly/client/EventProcessor.java +++ b/src/main/java/com/launchdarkly/client/EventProcessor.java @@ -2,6 +2,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.gson.Gson; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; @@ -62,7 +63,14 @@ class Consumer implements Runnable { Consumer(LDConfig config) { this.config = config; - client = HttpClients.custom().setProxy(config.proxyHost).build(); + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(config.connectTimeout) + .setSocketTimeout(config.socketTimeout) + .setProxy(config.proxyHost) + .build(); + client = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .build(); } @Override