title: Jersey Client opens too many Connections
body: <p>i run in some problems with my jersey rest api and a client. </p>
  
  <p>This is how im using the methods on a server side:</p>
  
  <pre><code>@POST
  @Path("/seed")
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  public Response addSeed(Seed seed) throws InterruptedException {
  
      if (!Validator.isValidSeed(seed)) {
          return Response.status(400).entity("{\"message\":\"Please verify your JSON!\", \"stat\":\"failed\"}")
                  .build();
      }
          save(seed);
          return Response.status(200).build();
  }
  </code></pre>
  
  <p>If i run a Jersey client in a while(true) loop, there are connections open and won't close. So im running into a problem i have a lot of connections open and my network crashes. So i can't use my server any more. After the connections are closed i can connect to the server. </p>
  
  <p>This is a client:</p>
  
  <pre><code>    ClientConfig config = new DefaultClientConfig();
      Client client = Client.create(config);
      WebResource service = client.resource(getBaseURI()).path("api/seed");
      while (true) {
              ClientResponse cr = service.header("Content-Type", "application/json").post(ClientResponse.class, seed);
              System.out.println(cr);
              cr.close();
  </code></pre>
  
  <p>My Questions are:</p>
  
  <p>What can i do on the server side, to prevent clients open a new connection?</p>
  
  <p>How can i specify a max number of connections?</p>
  
  <p>And how should i implement the jersey client to reuse open connection?</p>