code: private  void connectionCompleteCallback(WireCommand request, CompletableFuture<?> resultFuture,
                                               ConnectionWrapper connection, Throwable e) {
          if (connection == null || e != null) {
              ConnectionFailedException cause = e != null ? new ConnectionFailedException(e) : new ConnectionFailedException();
              resultFuture.completeExceptionally(new WireCommandFailedException(cause,
                      request.getType(),
                      WireCommandFailedException.Reason.ConnectionFailed));
          } else {                
              connection.sendAsync(request, resultFuture);
          }
      }
docs: Connection completion callback method. This is invoked when the future returned by the connection pool completes.
  If it succeeded, we will have a connection object where send the request.
  If it failed, the resultFuture is failed with ConnectionFailedException.
  @param request request to send over to segment store.
  @param resultFuture Future to complete in case of a connection failure. This future is completed in the reply
  processor in successful case.
  @param connection Connection object received upon successful completion of future from the request for new
  connection from the pool.
  @param e Exception, if any, thrown from attempting to get a new connection.