void (HttpClient client) { client.getParams().setConnectionManagerTimeout(3000); client.getParams().setSoTimeout(TaskSettings.getInstance().CONNECTION_TIMEOUT); if (isUseProxy()) { HttpConfigurable proxy = HttpConfigurable.getInstance(); client.getHostConfiguration().setProxy(proxy.PROXY_HOST, proxy.PROXY_PORT); if (proxy.PROXY_AUTHENTICATION && proxy.getProxyLogin() != null) { AuthScope authScope = new AuthScope(proxy.PROXY_HOST, proxy.PROXY_PORT); Credentials credentials = getCredentials(proxy.getProxyLogin(), proxy.getPlainProxyPassword(), proxy.PROXY_HOST); client.getState().setProxyCredentials(authScope, credentials); } } if (isUseHttpAuthentication()) { client.getParams().setCredentialCharset("UTF-8"); client.getParams().setAuthenticationPreemptive(true); client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(getUsername(), getPassword())); } else { client.getState().clearCredentials(); client.getParams().setAuthenticationPreemptive(false); } }