Java HttpClient Basic Credential 认证

HttpClient client = factory.getHttpClient(); //or any method to get a client instance
Credentials credentials = new UsernamePasswordCredentials(username, password);
client.getState().setCredentials(AuthScope.ANY, credentials);
原文地址:https://www.cnblogs.com/frankyou/p/7112589.html