code: private Channel getConnection()
      {
          stateCheck(State.RUNNING, State.HEALTH_CHECKING);
          boolean acquired = false;
          if (blockOnMaxConnections)
          {
              try
              {
                  logger.debug("Attempting to acquire channel permit");
  
                  if (!permits.tryAcquire())
                  {
                      logger.info("All connections in use for {}; had to wait for one.",
                                  remoteAddress);
                      permits.acquire();
                  }
                  acquired = true;
              }
              catch (InterruptedException ex)
              {
                  // no-op, don't care
              }
              catch (BlockingOperationException ex)
              {
                  logger.error("Netty interrupted waiting for connection permit to be available; {}",
                               remoteAddress);
              }
          }
          else
          {
              logger.debug("Attempting to acquire channel permit");
              acquired = permits.tryAcquire();
          }
  
          Channel channel = null;
          if (acquired)
          {
              try
              {
                  channel = doGetConnection(true);
                  channel.closeFuture().removeListener(inAvailableCloseListener);
              }
              catch (ConnectionFailedException ex)
              {
                  permits.release();
              }
              catch (UnknownHostException ex)
              {
                  permits.release();
                  logger.error("Unknown host encountered while trying to open connection; {}", ex);
              }
          }
          return channel;
      }
docs: Get a Netty channel from the pool.
  <p>
  The first thing this method does is attempt to acquire a permit from the
  Semaphore that controls the pool's behavior. Depending on whether
  {@code blockOnMaxConnections} is set, this will either block until one
  becomes available or return null.
  </p>
  <p>
  Once a permit has been acquired, a channel from the pool or a newly
  created one will be returned. If an attempt to create a new connection
  fails, null will then be returned.
  </p>
  @return a connected channel or {@code null}
  @see Builder#withBlockOnMaxConnections(boolean)