title: Closing connection in GET request using Jersey Client 2.22.1
body: <p>I am using Jersey client for REST calls from Java code:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
      &lt;version&gt;2.22.1&lt;/version&gt;
  &lt;/dependency&gt; 
  </code></pre>
  
  <p>In my GET request,  </p>
  
  <pre class="lang-java prettyprint-override"><code>javax.ws.rs.client.Invocation.Builder builder = ClientBuilder.newClient().target(url).request(); 
  builder.get().readEntity(String.class);
  </code></pre>
  
  <p>the client will be closed <em>automatically</em> after calling <code>readEntity(String.class)</code>.</p>
  
  <p>If I use,</p>
  
  <pre class="lang-java prettyprint-override"><code>builder.get(String.class);  
  </code></pre>
  
  <p>I get the same output. </p>
  
  <p>Is the connection closed automatically or do I need to close it manually in this case?</p>