Closed lucanicoletti closed 1 year ago
Hi @lucanicoletti the hivemq-mqtt-client does not add anything to the provided host. Where do you see the "mqtts://" prefix?
when I connect, I get the exception, with UnknownHostException: mqtts://{my host}
.
I figured out it's the protocol, and that I can set the protocols with .protocols(listOf())
providing a list of protocols, but the one I need fires a com.hivemq.client.mqtt.exceptions.ConnectionFailedException: java.lang.IllegalArgumentException: protocol ws is not supported
What do you pass to .serverHost(config.host)
? I suspect config.host
already contains mqtts://
.
The client library does not alter the provided hostname. There is not even an occurrence of "mqtts" in the code as you can see here: https://github.com/hivemq/hivemq-mqtt-client/search?q=mqtts
I figured out it's the protocol, and that I can set the protocols with .protocols(listOf()) providing a list of protocols
I guess you are referring to https://github.com/hivemq/hivemq-mqtt-client/blob/master/src/main/java/com/hivemq/client/mqtt/MqttClientSslConfigBuilderBase.java#L78. This is only to set the TLS protocol(s), for example "TLSv1.2" or "TLSv1.3".
Can you provide more details
Closing as it was completely my mistake! We received 2 values (one with mqtt pre-appended) and one without, a mapper deepdown our architecture was mapping the wrong one into the value (config.host) we were using. Thanks for the support.
Expected behavior
When I use
Mqtt3Client.builder()
and set host & port with.serverHost(config.host).serverPort(config.port)
, amqtts://
is appended, giving me aUnknownHostException
when trying to connect.Actual behavior
Do not modify the provided host+port
To Reproduce
Simply build a Mqtt3Client (async) with port and host, and try to connect, a "mqtts://" is appended at the host
Steps
Reproducer code
Details
com.hivemq:hivemq-mqtt-client:1.3.0