Sub Connect
mqtt.Initialize("mqtt", "ssl://10.10.10.81:8883", "id")
Dim mo As MqttConnectOptions
mo.Initialize("user", "password")
TrustAll(mo)
mqtt.Connect2(mo)
End Sub
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