WebSocket connection with proxy
Issue #86
closed
Hi Christian,
Our clients need to access the XMPP server through a proxy with authentication. And I'm facing two issues. The first one is that using:
WebSocketConnectionConfiguration.builder().proxy(proxy) with:
InetSocketAddress socketAddress = new InetSocketAddress(
"xxx.245.192.7", 8080);
Proxy proxy = new Proxy(Type.HTTP, socketAddress);
results in a "(JdkClientContainer.java:398) Invalid proxy 'http:///xxx.245.192.7:8080'" (please notice the triple "/").
The second one is that I can't see how to set a proxy login/password. Did I miss something? Or should I use Authenticator.setDefault() or something like that?
Comments (6)
-
repo owner -
repo owner First issue addressed with 7618f27
-
reporter Thanks. I'll try to test the authentication method as soon as our infrastructure is operational.
-
repo owner Fixed with 0.7.3.
-
repo owner - changed status to resolved
-
repo owner - changed status to closed
- Log in to comment
The third slash is due to some weird (inconstistent) behavior in JDKs toString() implementations. (Happens only when using an IP address, not a hostname).
As a workaround, try
It's better to use anyway, since the Proxy is only used to carry the host information, but not to resolve it. (it's transferred into an HTTP URI, and used internally by the WebSocket library - Tyrus).
As far as Proxy authentication is concerned: I've never actually had the ability to test it, but I guess, you could try basic Java HTTP authentication. E.g. with Authenticator, like here: http://stackoverflow.com/q/1626549
Let me know, if this works.