title: Endpoint is not connected in httpclient5-beta
body: <p>Hi I m trying to use httpcomponents5 beta to make persistent connection, I have tried the example given in their site, the code is as follows,</p>
  
  <pre><code>final IOReactorConfig ioReactorConfig = IOReactorConfig.custom().setSoTimeout(Timeout.ofSeconds(45)).setSelectInterval(10000).setSoReuseAddress(true).setSoKeepAlive(true).build();
  final SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(new TrustAllStrategy()).build();
  final PoolingAsyncClientConnectionManager connectionManager = PoolingAsyncClientConnectionManagerBuilder.create().setConnectionTimeToLive(TimeValue.of(1, TimeUnit.DAYS)).setTlsStrategy(new H2TlsStrategy(sslContext, NoopHostnameVerifier.INSTANCE)).build();
  client = HttpAsyncClients.createMinimal(protocol, H2Config.DEFAULT, null, ioReactorConfig, connectionManager);
  client.start();
  final org.apache.hc.core5.http.HttpHost target = new org.apache.hc.core5.http.HttpHost("localhost", 8000, "https");
  Future&lt;AsyncClientEndpoint&gt; leaseFuture = client.lease(target, null);
  AsyncClientEndpoint asyncClientEndpoint = leaseFuture.get(60, TimeUnit.SECONDS);
  final CountDownLatch latch = new CountDownLatch(1);
  final AsyncRequestProducer requestProducer = AsyncRequestBuilder.post(target.getSchemeName()+"://"+target.getHostName()+":"+target.getPort()+locationposturl).addParameter(new BasicNameValuePair("info", requestData)).setEntity(new StringAsyncEntityProducer("json post data will go here", ContentType.APPLICATION_JSON)).setHeader("Pragma", "no-cache").setHeader("from", "http5").setHeader("Custom", customheaderName).setHeader("Secure", secureHeader).build();
  locEndPoint.execute(requestProducer, SimpleResponseConsumer.create(), new FutureCallback&lt;SimpleHttpResponse&gt;() {
      @Override
      public void completed(final SimpleHttpResponse response) {
          if (response != null) {
              if (response.getCode() &gt; -1) {
                  try {
  
                      System.out.println("http5:: COMPLETED : RESPONSE "+response.getBodyText());
                  } catch (Exception e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
              }
          }
          latch.countDown();
      }
  
      @Override
      public void failed(final Exception ex) {
          System.out.println("http5:: FAILED : "+target+locationposturl);
          LoggerUtil.printStackTrace(ex);
          System.out.println("http5::Exception Request failed "+LoggerUtil.getStackTrace(ex));
          latch.countDown();
      }
  
      @Override
      public void cancelled() {
          System.out.println("http5:: CANCELLED : "+target+locationposturl);
          System.out.println(http5::Exception Request cancelled");
          latch.countDown();
      }
  });
  latch.await();
  </code></pre>
  
  <p>This code works without a problem for the first time,but when I send a subsequent  requests it throws an exception as follows,</p>
  
  <blockquote>
    <p>http5:: Exception occured java.lang.IllegalStateException: Endpoint is
    not connected     at
    org.apache.hc.core5.util.Asserts.check(Asserts.java:38)   at
    org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager$InternalConnectionEndpoint.getValidatedPoolEntry(PoolingAsyncClientConnectionManager.java:497)
      at
    org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager$InternalConnectionEndpoint.execute(PoolingAsyncClientConnectionManager.java:552)
      at
    org.apache.hc.client5.http.impl.async.MinimalHttpAsyncClient$InternalAsyncClientEndpoint.execute(MinimalHttpAsyncClient.java:405)
      at
    org.apache.hc.core5.http.nio.AsyncClientEndpoint.execute(AsyncClientEndpoint.java:81)
      at
    org.apache.hc.core5.http.nio.AsyncClientEndpoint.execute(AsyncClientEndpoint.java:114)</p>
  </blockquote>
  
  <p>What may be the problem with endpoint, I m forcing endpoint to keep alive for a day, kindly shed some light on this</p>