code: protected HttpClient buildClient() {
          HttpClientBuilder builder = HttpClientBuilder.create().useSystemProperties().setConnectionManager(connManager);
          if (!isBlank(username) && !isBlank(password)) {
              final URI uri = URI.create(url);
              final CredentialsProvider credsProvider = new BasicCredentialsProvider();
              credsProvider.setCredentials(new AuthScope(uri.getHost(), uri.getPort()),
                  new UsernamePasswordCredentials(username, password));
              builder = builder.setDefaultCredentialsProvider(credsProvider);
          }
          return builder.build();
      }
docs: Setup authentication in httpclient.
  @return the setup of authentication