Cannot set timeout on Resteasy Client on JBoss
<p>I am trying to create a rest client on a <code>JBoss EAP</code> server, and I need to make sure that a timeout will end the connection if it gets stuck.</p>

<p>My code looks like this:</p>

<pre><code>int timeout = 5000;
RequestConfig defaultRequestConfig = RequestConfig.custom().setConnectionRequestTimeout(timeout).setSocketTimeout(timeout).setConnectTimeout(timeout).build();
HttpClientBuilder builder = HttpClientBuilder.create();
HttpClient httpClient = builder.setDefaultRequestConfig(defaultRequestConfig).build();
// Previous try
// HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build();

ClientExecutor executor = new ApacheHttpClient4Executor(httpClient);        

ClientRequest cr = new ClientRequest("http://www.someserviceurl.com/", executor);
JSONObject jData = new JSONObject();

jData.put("param1", param1);
jData.put("param2", param2);

cr.accept("application/json");
cr.body("application/json", jData.toString());

ClientResponse&lt;String&gt; cres = cr.post(String.class);
</code></pre>

<p>Currently this code does not get a timeout, but just gets stuck forever. What am I doing wrong?</p>