eclipse / paho.mqtt.java

Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
2.08k stars 879 forks source link

Mqtt Client Can't connect through http proxy #1024

Open onkariwaligunje opened 7 months ago

onkariwaligunje commented 7 months ago

Hello,

mqtt paho java client cannot connect to server through http proxy from an android device. Getting below error: ERROR-MqttAgent Error message: Connection to the Mqtt Failed due to MqttException (0) - java.net.SocketTimeoutException: after 90000ms: isConnected failed: ETIMEDOUT (Connection timed out)

Tried to check if same issue is there using android service, but when using android service got below error: java.lang.IllegalArgumentException: com.lenovo.udcsystem: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

Is there any way to send http proxy details to Mqtt while making a connect call to make a successful connection?

Any help is greatly appreciated. Thanks!

[] Bug exists Release Version 1.1.1 (Java Repository Master Branch) Bug exists in Snapshot Version 1.1.2-SNAPSHOT (Android Service Repository Master Branch) Bug is just in the Sample Application. Android API Version Bug Seen on: and Android Version Bug Seen on: Android 13 (API level 33) mqtt version : mqttv3 (1.2.5)

Please also check that if you have found the bug in the Release version (1.1.1) that you check that it also exists in the Snapshot (1.1.2-SNAPSHOT) before raising a bug.

Description of Bug: Connect to server without having proxy set on android device - client gets connected to server Connect to server after setting proxy on android device - client is unable to connect to server Tried using ssl:// and wss:// for connection, but client is not able to connect to server through proxy Proxy is http proxy

Console Log output (if available): ERROR-MqttAgent Error message: Connection to the Mqtt Failed due to MqttException (0) - java.net.SocketTimeoutException: failed to connect to / (port 443) from / (port 47692) after 90000ms: isConnected failed: ETIMEDOUT (Connection timed out)

onkariwaligunje commented 7 months ago

https://github.com/eclipse/paho.mqtt.java/pull/1010 The changes in this PR provides proxy support. I tried building code and tested it and it does establishes the connection to over a proxy. Is there any plan to merge this PR?