-
Notifications
You must be signed in to change notification settings - Fork 911
Open
Description
- Bug exists Release Version 1.2.0 ( Master Branch)
Hello everyone,
I want to use a proxy with websocket MQTT client but the programm does not take the http proxy into account and instead it tries to use a socks proxy. And even with a socks proxy i have the following error: java.net.SocketException: Malformed reply from SOCKS server : MqttException
Is this normal?
UPDATE:
We are able to use now an HTTP proxy by using a custom ConnectionFactory, but now we have an authentication problem even though i used an authenticator and the client is hanged!
This is the code:
class SocksSocketFactory extends SocketFactory {
public Socket createSocket() throws IOException{
final String username = "xxxxx";
final String password = "xxxxx";
Authenticator.setDefault(new Authenticator() {
protected java.net.PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password.toCharArray());
}
});
System.setProperty("http.proxyHost", "proxy.enterprise.com");
System.setProperty("http.proxyPort", "80");
System.setProperty("http.proxyUser", username);
System.setProperty("http.proxyPassword", password);
InetSocketAddress httpProxy = new InetSocketAddress("proxy.enterprise.com", 80);
Proxy proxy = new Proxy(Proxy.Type.HTTP, httpProxy);
Socket sock = new Socket(proxy);
return sock;
}
Thank you in advance,
Amir
Metadata
Metadata
Assignees
Labels
No labels