title: Adding socket timeout to http4 client using RequestConfig in Java DSL in Camel
body: <p>So, I have a <code>route</code> which essentially looks like this-</p>
  
  <pre><code>from("direct:send_success")
          .to("http4://localhost:8089/mock/success?httpClient.socketTimeout=1000");
  </code></pre>
  
  <p>Using this way, I'm able to apply socket timeout of 1 sec successfully. I am using <code>ProducerTemplate</code> to invoke this route. This is all fine. But when I change the route to-</p>
  
  <pre><code>from("direct:send_success")
      .to("http4://localhost:8089/mock/success");
  </code></pre>
  
  <p>And route invocation to-</p>
  
  <pre><code>ProducerTemplate pt = ctx.createProducerTemplate();
  Exchange ex = pt.send("direct:send_success", exOb -&gt; {
      HttpComponent httpComp = exOb.getContext().getComponent("http4", HttpComponent.class);
      exOb.getContext().getComponent("http4", HttpComponent.class).setHttpClientConfigurer(httpClientBuilder -&gt; {
              HttpClientBuilder
                  .create()
                  .setDefaultRequestConfig(requestConfigWithTimeout(1000))
                  .build();
          });
  });
  </code></pre>
  
  <p>And the method <code>requestConfigWithTimeout()</code> as-</p>
  
  <pre><code>private static RequestConfig requestConfigWithTimeout(int timeoutInMilliseconds) {
      return RequestConfig.copy(RequestConfig.DEFAULT)
              .setSocketTimeout(timeoutInMilliseconds)
              .build();
  }
  </code></pre>
  
  <p>The timeout settings are not applied. Where am I going wrong?</p>