* @param password (optional) password to access sonar
* @param useProxy flag to indicate whether IDEA's proxy settings shall be used to connect to Sonar
* @return a connection to Sonar
*/
public static Sonar getSonar(String host, String user, String password, boolean useProxy) {
Host hostServer = new Host(fixHostName(host));
// 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) {