Credentials credentials = new UsernamePasswordCredentials(userId, password);
HttpClient httpClient = new HttpClient();
httpClient.getState().setCredentials(AuthScope.ANY, credentials);
httpClient.getParams().setAuthenticationPreemptive(true);
ClientExecutor clientExecutor = new ApacheHttpClientExecutor(httpClient);
try {
URI uri = new URI(DEVGARDEN_SECURE_TOKEN_SERVER);
ClientRequestFactory fac = new ClientRequestFactory(clientExecutor,uri);