title: Set connection time out with javax.ws.rs.client.WebTarget
body: <p>I have an URL for which I am trying to set connection time out for 10 seconds.
  Code snippet :-</p>
  
  <pre><code>WebTarget t=null;
  Client c = ClientBuilder.newBuilder()
                  .hostnameVerifier(&lt;HostNameVerifier&gt;)
                  .sslContext(&lt;SSLContext&gt;)
                  .build();
          client.register(&lt;credentials for url&gt;); 
          t = c.t(url);
  </code></pre>
  
  <p>From different sources, I have found the solution like below.</p>
  
  <pre><code>ClientConfig clientConfig = new ClientConfig();
  clientConfig.property(ClientProperties.READ_TIMEOUT, 2000);
  clientConfig.property(ClientProperties.CONNECT_TIMEOUT, 500);
  </code></pre>
  
  <p>But both <strong><em>ClientConfig</em></strong> and <strong><em>ClientProperties</em></strong> is a utility of <strong>org.glassfish.jersey.client</strong> package. 
  I have a limitation to use this.</p>
  
  <p>Can anyone suggest here how to set connection timeout without using ClientConfig and ClientProperties.</p>
  
  <p>Any help will be appreciated.</p>