eclipse-paho / eclipse-paho/paho.mqtt.java

Using Java eclipse.paho.mqttv5 with ssl certificate gets an error Unsupported protocol version

Open
#927 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
919
PR merge metrics
No merged PRs in 30d

Description

Hi Paho mqttv5 for Java

I am having a problem getting my Java eclipse.paho.mqttv5 client with bouncycastle library to connect secure MQTT Broker using ssl certicate.
I am getting an error of
Unsupported protocol version. (132)
at org.eclipse.paho.mqttv5.client.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:32)
at org.eclipse.paho.mqttv5.client.internal.ClientState.notifyReceivedAck(ClientState.java:1074)
at org.eclipse.paho.mqttv5.client.internal.CommsReceiver.run(CommsReceiver.java:153)
at java.base/java.lang.Thread.run(Thread.java:835)

Please see [TestMQTT.zip](https://github.com/eclipse/paho.mqtt.java/files/8553670/TestMQTT.zip)
which cotains MQTTV5WithSSL.java and TestMQTTV3SSL.java

Note using JDK 12, SSLSocketFactory getSocketFactory(...) in my TestMQTTV3SSL.java class, I am able to publish and subscribe using to secure MQTT Broker. Using mosquitto_pub and mosquitto_sub also work.

Can you please have a look at my MQTTV5WithSSL.java advise what I need to do inorder MQTT 5.x. works with SSL certificate.
Thank you for your help and support

Regards, Bao Quach

Below are my Maven dependencies

org.eclipse.paho
org.eclipse.paho.client.mqttv3
1.2.2

org.eclipse.paho
org.eclipse.paho.mqttv5.client
1.2.5

org.bouncycastle
bcpkix-jdk15on
1.64

Contributor guide

Open the contributing guide

Research direction

Start with the attached MQTTV5WithSSL.java and compare its connection setup with TestMQTTV3SSL.java, which reportedly works against the same secure broker. Reproduce the Unsupported protocol version (132) failure using the listed Java, Paho, and Bouncy Castle dependencies, then inspect the MQTT 5 connection and SSL configuration. Done means the MQTT 5 client connects securely and can publish and subscribe without the protocol-version error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.