// use credentials for Sonar in case they are specified
if (user != null && password != null) {
hostServer.setUsername(user);
hostServer.setPassword(password);
}
final HttpClient4Connector connector = new HttpClient4Connector(hostServer);
// check whether IDEA has a proxy set
HttpConfigurable proxySettings = HttpConfigurable.getInstance();
if (useProxy && proxySettings.USE_HTTP_PROXY) {
DefaultHttpClient httpClient = connector.getHttpClient();
// set proxy authentication if needed
if (proxySettings.PROXY_AUTHENTICATION) {
AuthScope authScope = new AuthScope(proxySettings.PROXY_HOST, proxySettings.PROXY_PORT);
UsernamePasswordCredentials proxyCredentials = new UsernamePasswordCredentials(
proxySettings.PROXY_LOGIN, proxySettings.getPlainProxyPassword());