0

Trying to connect to an MQTT broker using the eclipse paho (1.0.2) java library using a url of the form tls:// ... throws an IllegalArgumentException. Not surprising, it's specifically disallowed in the code (although ssl is available). Connecting calls this method in MqttConnectOptions

protected static int validateURI(String srvURI) {
        try {
            URI vURI = new URI(srvURI);
            if (!vURI.getPath().equals("")) {
                throw new IllegalArgumentException(srvURI);
            }
            if (vURI.getScheme().equals("tcp")) {
                return URI_TYPE_TCP;
            }
            else if (vURI.getScheme().equals("ssl")) {
                return URI_TYPE_SSL;
            }
            else if (vURI.getScheme().equals("local")) {
                return URI_TYPE_LOCAL;
            }
            else {
                throw new IllegalArgumentException(srvURI);
            }
        } catch (URISyntaxException ex) {
            throw new IllegalArgumentException(srvURI);
        }
    }

Is there some way around this limitation? Alternately, is there some reason this is blocked? How do people use this client with these urls? Any help appreciated.

ralight
  • 11,033
  • 3
  • 49
  • 59
Steve B.
  • 55,454
  • 12
  • 93
  • 132
  • Have you considered raising this on the Paho mailing list or bug tracker? I think it is just a case of the very common ssl==tls shorthand rather than specifically blocking tls. – ralight May 20 '15 at 08:24

1 Answers1

0

I just encountered the same problem using the same Eclipse Paho (1.0.2) library, and got it running (to some extend) after changing the broker URI to "ssl://.....". At least I am able to initialize a SSL handshake so far.

nyyrikki
  • 1,436
  • 1
  • 21
  • 32