Greetings All,
The following worked perfectly when compiled under older versions of B4J, however, seems to be ineffective with current B4J Version 9. I was using it to connect to a Mosquitto MQTT broker without issue. However, I now have a situation where existing B4J MQTT Clients (compiled under older versions of B4J) are connecting to the broker BUT a new instance (exactly the same code) compiled under B4J Version 9 (today) gets rejected.
Has anyone else noticed this? Any ideas as to how to rectify or prove otherwise??
Open to any/all suggestions. I may well be entirely wrong in relation to this so apologies in advance!
Thank you.
The following worked perfectly when compiled under older versions of B4J, however, seems to be ineffective with current B4J Version 9. I was using it to connect to a Mosquitto MQTT broker without issue. However, I now have a situation where existing B4J MQTT Clients (compiled under older versions of B4J) are connecting to the broker BUT a new instance (exactly the same code) compiled under B4J Version 9 (today) gets rejected.
B4X:
'Depends on JavaObject and jNet or Net libraries
Sub TrustAll (mo As MqttConnectOptions)
Dim SSLContext As JavaObject
SSLContext = SSLContext.InitializeStatic("javax.net.ssl.SSLContext").RunMethod("getInstance", Array("TLS"))
Dim tm As CustomTrustManager
tm.InitializeAcceptAll
SSLContext.RunMethod("init", Array(Null, tm, Null))
Dim jmo As JavaObject = mo
jmo.RunMethod("setSocketFactory", Array(SSLContext.RunMethod("getSocketFactory", Null)))
End Sub
Has anyone else noticed this? Any ideas as to how to rectify or prove otherwise??
Open to any/all suggestions. I may well be entirely wrong in relation to this so apologies in advance!
Thank you.