-
In one of our projects, we're currently handling proxy authentication using Apache HttpClient as shown below. How can we achieve similar proxy authentication when using the Pushy library? HttpHost proxy = new HttpHost("x.x.com",8080);
Credentials credentials = new UsernamePasswordCredentials("username","password");
AuthScope authScope = new AuthScope("x.x.com", 8080);
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(authScope, credentials);
HttpClient client = HttpClientBuilder.create().setProxy(proxy).setDefaultCredentialsProvider(credsProvider).build();
HttpResponse response=client.execute(new HttpGet("http://stackoverflow.com/")); |
Beta Was this translation helpful? Give feedback.
Answered by
jchambers
Jun 3, 2025
Replies: 1 comment 3 replies
-
Please see:
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the most immediate way forward for you would be to implement your own
ProxyHandlerFactory
that instantiates anHttpProxyHandler
with a specific set of headers. The existingHttpProxyHandlerFactory
has a lot of machinery you probably don't need; ultimately, I think you'd want something really simple that just does: