Skip to content

Instantly share code, notes, and snippets.

@mstine
Created August 5, 2015 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mstine/e086fad2f1b61de4634e to your computer and use it in GitHub Desktop.
Save mstine/e086fad2f1b61de4634e to your computer and use it in GitHub Desktop.
receptor client + basic auth
@Bean
public ReceptorClient receptorClient() {
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(
new AuthScope(receptorUri, 80),
new UsernamePasswordCredentials(receptorUser, receptorPassword)
);
CloseableHttpClient httpClient = HttpClients.custom()
.setDefaultCredentialsProvider(credentialsProvider)
.build();
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient);
return new ReceptorClient(receptorUri, factory);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment