if (config.hasConfiguredHostAndPort()) {
client.getHostConfiguration().setProxy(config.getProxyHost(), config.getProxyPort());
if (config.hasConfiguredCredentials()) {
client.getState().setProxyCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(config.getProxyUsername(), config.getProxyPassword()));
}
}
}
}