diff --git a/build.gradle b/build.gradle
index bccb44c47..e4e14aa43 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,9 +17,7 @@ plugins {
allprojects {
repositories {
- mavenLocal()
mavenCentral()
- jcenter()
}
}
@@ -149,6 +147,11 @@ allprojects {
'-removeheaders': 'Private-Package')
}
+ javadoc {
+ options.encoding 'UTF-8'
+ exclude '**/internal/**'
+ }
+
task javadocJar(type: Jar) {
group 'documentation'
description 'Assembles a jar archive containing the javadoc.'
diff --git a/src/main/java/com/hivemq/client/internal/mqtt/codec/encoder/MqttEncoder.java b/src/main/java/com/hivemq/client/internal/mqtt/codec/encoder/MqttEncoder.java
index 10a39da38..f435800b8 100644
--- a/src/main/java/com/hivemq/client/internal/mqtt/codec/encoder/MqttEncoder.java
+++ b/src/main/java/com/hivemq/client/internal/mqtt/codec/encoder/MqttEncoder.java
@@ -59,7 +59,7 @@ public void write(
if (msg instanceof MqttMessage) {
final MqttMessage message = (MqttMessage) msg;
- final MqttMessageEncoder messageEncoder = encoders.get(message.getType().getCode());
+ final MqttMessageEncoder> messageEncoder = encoders.get(message.getType().getCode());
if (messageEncoder == null) {
throw new UnsupportedOperationException();
}
diff --git a/src/main/java/com/hivemq/client/internal/mqtt/codec/encoder/MqttMessageEncoders.java b/src/main/java/com/hivemq/client/internal/mqtt/codec/encoder/MqttMessageEncoders.java
index 431fc4d0d..a1b5cee0d 100644
--- a/src/main/java/com/hivemq/client/internal/mqtt/codec/encoder/MqttMessageEncoders.java
+++ b/src/main/java/com/hivemq/client/internal/mqtt/codec/encoder/MqttMessageEncoders.java
@@ -27,7 +27,7 @@
*/
public abstract class MqttMessageEncoders {
- protected final @NotNull MqttMessageEncoder @NotNull [] encoders = new MqttMessageEncoder[16];
+ protected final @NotNull MqttMessageEncoder> @NotNull [] encoders = new MqttMessageEncoder[16];
/**
* Returns the corresponding encoder to the given MQTT message type code.
@@ -36,7 +36,7 @@ public abstract class MqttMessageEncoders {
* @return the corresponding decoder to the MQTT message type code or null if there is no encoder for the MQTT
* message type code.
*/
- public final @Nullable MqttMessageEncoder get(final int code) {
+ public final @Nullable MqttMessageEncoder> get(final int code) {
if (code < 0 || code >= encoders.length) {
return null;
}
diff --git a/src/main/java/com/hivemq/client/internal/mqtt/message/MqttCommonReasonCode.java b/src/main/java/com/hivemq/client/internal/mqtt/message/MqttCommonReasonCode.java
index 6babeb5d4..2bf7c1b77 100644
--- a/src/main/java/com/hivemq/client/internal/mqtt/message/MqttCommonReasonCode.java
+++ b/src/main/java/com/hivemq/client/internal/mqtt/message/MqttCommonReasonCode.java
@@ -59,9 +59,6 @@ public enum MqttCommonReasonCode implements Mqtt5ReasonCode {
this.code = code;
}
- /**
- * @return the byte code of this Reason Code.
- */
@Override
public int getCode() {
return code;
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt3/message/connect/connack/Mqtt3ConnAckReturnCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt3/message/connect/connack/Mqtt3ConnAckReturnCode.java
index 8265abe7f..2ed32b91c 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt3/message/connect/connack/Mqtt3ConnAckReturnCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt3/message/connect/connack/Mqtt3ConnAckReturnCode.java
@@ -30,11 +30,29 @@
*/
public enum Mqtt3ConnAckReturnCode implements Mqtt3ReturnCode {
+ /**
+ * The connection is accepted.
+ */
SUCCESS,
+ /**
+ * The server does not support the version of the MQTT protocol requested by the client.
+ */
UNSUPPORTED_PROTOCOL_VERSION,
+ /**
+ * The client identifier is formed correctly but is not accepted by the server.
+ */
IDENTIFIER_REJECTED,
+ /**
+ * The MQTT service is not available.
+ */
SERVER_UNAVAILABLE,
+ /**
+ * The server does not accept the user name or password specified by the client.
+ */
BAD_USER_NAME_OR_PASSWORD,
+ /**
+ * The client is not authorized to connect.
+ */
NOT_AUTHORIZED;
private static final @NotNull Mqtt3ConnAckReturnCode[] VALUES = values();
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt3/message/subscribe/suback/Mqtt3SubAckReturnCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt3/message/subscribe/suback/Mqtt3SubAckReturnCode.java
index b7927830f..b17e30feb 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt3/message/subscribe/suback/Mqtt3SubAckReturnCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt3/message/subscribe/suback/Mqtt3SubAckReturnCode.java
@@ -29,9 +29,23 @@
*/
public enum Mqtt3SubAckReturnCode implements Mqtt3ReturnCode {
+ /**
+ * The subscription is accepted and the maximum QoS sent will be QoS 0 (this might be a lower QoS than was
+ * requested).
+ */
SUCCESS_MAXIMUM_QOS_0(0),
+ /**
+ * The subscription is accepted and the maximum QoS sent will be QoS 1 (this might be a lower QoS than was
+ * requested).
+ */
SUCCESS_MAXIMUM_QOS_1(1),
+ /**
+ * The subscription is accepted and the maximum QoS sent will be QoS 2.
+ */
SUCCESS_MAXIMUM_QOS_2(2),
+ /**
+ * The subscription failed.
+ */
FAILURE(128);
private final int code;
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/auth/Mqtt5AuthReasonCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/auth/Mqtt5AuthReasonCode.java
index b1d556220..0d345e498 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/auth/Mqtt5AuthReasonCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/auth/Mqtt5AuthReasonCode.java
@@ -30,8 +30,17 @@
*/
public enum Mqtt5AuthReasonCode implements Mqtt5ReasonCode {
+ /**
+ * Authentication is successful.
+ */
SUCCESS(MqttCommonReasonCode.SUCCESS),
+ /**
+ * Continue the authentication with another step.
+ */
CONTINUE_AUTHENTICATION(0x18),
+ /**
+ * Initiate a re-authentication.
+ */
REAUTHENTICATE(0x19);
private final int code;
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/connect/connack/Mqtt5ConnAckReasonCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/connect/connack/Mqtt5ConnAckReasonCode.java
index d1fd75242..d8d9ad9fe 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/connect/connack/Mqtt5ConnAckReasonCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/connect/connack/Mqtt5ConnAckReasonCode.java
@@ -30,27 +30,93 @@
*/
public enum Mqtt5ConnAckReasonCode implements Mqtt5ReasonCode {
+ /**
+ * The connection is accepted.
+ */
SUCCESS(MqttCommonReasonCode.SUCCESS),
+ /**
+ * The server either does not want to reveal the reason for the failure or none of the other reason codes apply.
+ */
UNSPECIFIED_ERROR(MqttCommonReasonCode.UNSPECIFIED_ERROR),
+ /**
+ * The CONNECT packet could not be parsed correctly according to the MQTT specification.
+ */
MALFORMED_PACKET(MqttCommonReasonCode.MALFORMED_PACKET),
+ /**
+ * The CONNECT packet contained data that is not allowed by the MQTT protocol.
+ */
PROTOCOL_ERROR(MqttCommonReasonCode.PROTOCOL_ERROR),
+ /**
+ * The CONNECT packet is valid but is not accepted by the server.
+ */
IMPLEMENTATION_SPECIFIC_ERROR(MqttCommonReasonCode.IMPLEMENTATION_SPECIFIC_ERROR),
+ /**
+ * The server does not support the version of the MQTT protocol requested by the client.
+ */
UNSUPPORTED_PROTOCOL_VERSION(0x84),
+ /**
+ * The client identifier is formed correctly but is not accepted by the server.
+ */
CLIENT_IDENTIFIER_NOT_VALID(0x85),
+ /**
+ * The server does not accept the user name or password specified by the client.
+ */
BAD_USER_NAME_OR_PASSWORD(0x86),
+ /**
+ * The client is not authorized to connect.
+ */
NOT_AUTHORIZED(MqttCommonReasonCode.NOT_AUTHORIZED),
+ /**
+ * The MQTT service is not available.
+ */
SERVER_UNAVAILABLE(0x88),
+ /**
+ * The server is busy. Try again later.
+ */
SERVER_BUSY(MqttCommonReasonCode.SERVER_BUSY),
+ /**
+ * This client has been banned by administrative action. Contact the server administrator.
+ */
BANNED(0x8A),
+ /**
+ * The authentication method is not supported or does not match the authentication method currently in use.
+ */
BAD_AUTHENTICATION_METHOD(MqttCommonReasonCode.BAD_AUTHENTICATION_METHOD),
+ /**
+ * The Will topic name is formed correctly but is not accepted by the server.
+ */
TOPIC_NAME_INVALID(MqttCommonReasonCode.TOPIC_NAME_INVALID),
+ /**
+ * The CONNECT packet exceeded the maximum permissible size.
+ */
PACKET_TOO_LARGE(MqttCommonReasonCode.PACKET_TOO_LARGE),
+ /**
+ * An implementation or administrative imposed limit has been exceeded.
+ */
QUOTA_EXCEEDED(MqttCommonReasonCode.QUOTA_EXCEEDED),
+ /**
+ * The Will payload does not match the specified payload format indicator.
+ */
PAYLOAD_FORMAT_INVALID(MqttCommonReasonCode.PAYLOAD_FORMAT_INVALID),
+ /**
+ * The server does not support retained messages, but the Will retain flag was set.
+ */
RETAIN_NOT_SUPPORTED(MqttCommonReasonCode.RETAIN_NOT_SUPPORTED),
+ /**
+ * The server does not support the QoS of the Will.
+ */
QOS_NOT_SUPPORTED(MqttCommonReasonCode.QOS_NOT_SUPPORTED),
+ /**
+ * The client should temporarily use another server.
+ */
USE_ANOTHER_SERVER(MqttCommonReasonCode.USE_ANOTHER_SERVER),
+ /**
+ * The client should permanently use another server.
+ */
SERVER_MOVED(MqttCommonReasonCode.SERVER_MOVED),
+ /**
+ * The connection rate limit has been exceeded.
+ */
CONNECTION_RATE_EXCEEDED(MqttCommonReasonCode.CONNECTION_RATE_EXCEEDED);
private final int code;
@@ -85,8 +151,8 @@ public int getCode() {
* Returns the CONNACK Reason Code belonging to the given byte code.
*
* @param code the byte code.
- * @return the CONNACK Reason Code belonging to the given byte code or null if the byte code is not a valid CONNACK
- * Reason Code code.
+ * @return the CONNACK Reason Code belonging to the given byte code or null
if the byte code is not a
+ * valid CONNACK Reason Code code.
*/
public static @Nullable Mqtt5ConnAckReasonCode fromCode(final int code) {
if (code == SUCCESS.code) {
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/disconnect/Mqtt5DisconnectReasonCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/disconnect/Mqtt5DisconnectReasonCode.java
index 4c429f9de..4b6f54e0f 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/disconnect/Mqtt5DisconnectReasonCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/disconnect/Mqtt5DisconnectReasonCode.java
@@ -32,35 +32,129 @@
*/
public enum Mqtt5DisconnectReasonCode implements Mqtt5ReasonCode {
+ /**
+ * Disconnect normally. The server must not publish the Will message.
+ */
NORMAL_DISCONNECTION(0x00),
+ /**
+ * Disconnect normally. The server must also publish the Will message.
+ */
DISCONNECT_WITH_WILL_MESSAGE(0x04),
+ /**
+ * The sender either does not want to reveal the reason for the disconnect or none of the other reason codes apply.
+ */
UNSPECIFIED_ERROR(MqttCommonReasonCode.UNSPECIFIED_ERROR),
+ /**
+ * A packet could not be parsed correctly according to the MQTT specification.
+ */
MALFORMED_PACKET(MqttCommonReasonCode.MALFORMED_PACKET),
+ /**
+ * A packet contained data that is not allowed by the MQTT protocol or is inconsistent with the state of the
+ * receiver.
+ */
PROTOCOL_ERROR(MqttCommonReasonCode.PROTOCOL_ERROR),
+ /**
+ * A packet is valid but can not be processed by the implementation of the receiver.
+ */
IMPLEMENTATION_SPECIFIC_ERROR(MqttCommonReasonCode.IMPLEMENTATION_SPECIFIC_ERROR),
+ /**
+ * The client is not authorized to perform a request.
+ */
NOT_AUTHORIZED(MqttCommonReasonCode.NOT_AUTHORIZED),
+ /**
+ * The server is busy and can not continue processing requests from the client.
+ */
SERVER_BUSY(MqttCommonReasonCode.SERVER_BUSY),
+ /**
+ * The server is shutting down.
+ */
SERVER_SHUTTING_DOWN(0x8B),
+ /**
+ * The authentication method is not supported or does not match the authentication method currently in use.
+ */
BAD_AUTHENTICATION_METHOD(MqttCommonReasonCode.BAD_AUTHENTICATION_METHOD),
+ /**
+ * The connection is closed because no packet has been received for 1.5 times the keep alive time.
+ */
KEEP_ALIVE_TIMEOUT(0x8D),
+ /**
+ * Another client using the same client identifier has connected.
+ */
SESSION_TAKEN_OVER(0x8E),
+ /**
+ * A packet contained a topic filter that is formed correctly but is not accepted by the server.
+ */
TOPIC_FILTER_INVALID(MqttCommonReasonCode.TOPIC_FILTER_INVALID),
+ /**
+ * A packet contained a topic name that is formed correctly but is not accepted by the receiver.
+ */
TOPIC_NAME_INVALID(MqttCommonReasonCode.TOPIC_NAME_INVALID),
+ /**
+ * The receiver has received more publications for which it has not sent PUBACK or PUBCOMP than allowed by the
+ * receive maximum it sent in the CONNECT or CONNACK packet.
+ */
RECEIVE_MAXIMUM_EXCEEDED(0x93),
+ /**
+ * The receiver has received a PUBLISH packet containing a topic alias which is greater than the maximum topic alias
+ * it sent in the CONNECT or CONNACK packet.
+ */
TOPIC_ALIAS_INVALID(0x94),
+ /**
+ * The receiver has received a packet with a greater size than allowed by the maximum packet size it sent in the
+ * CONNECT or CONNACK packet.
+ */
PACKET_TOO_LARGE(MqttCommonReasonCode.PACKET_TOO_LARGE),
+ /**
+ * The received data rate is too high.
+ */
MESSAGE_RATE_TOO_HIGH(0x96),
+ /**
+ * An implementation or administrative imposed limit has been exceeded.
+ */
QUOTA_EXCEEDED(MqttCommonReasonCode.QUOTA_EXCEEDED),
+ /**
+ * The connection is closed due to an administrative action.
+ */
ADMINISTRATIVE_ACTION(0x98),
+ /**
+ * A payload does not match the specified payload format indicator.
+ */
PAYLOAD_FORMAT_INVALID(MqttCommonReasonCode.PAYLOAD_FORMAT_INVALID),
+ /**
+ * The server does not support retained messages.
+ */
RETAIN_NOT_SUPPORTED(MqttCommonReasonCode.RETAIN_NOT_SUPPORTED),
+ /**
+ * The client specified a QoS greater than the maximum QoS the server sent in the CONNACK packet.
+ */
QOS_NOT_SUPPORTED(MqttCommonReasonCode.QOS_NOT_SUPPORTED),
+ /**
+ * The client should temporarily use another server.
+ */
USE_ANOTHER_SERVER(MqttCommonReasonCode.USE_ANOTHER_SERVER),
+ /**
+ * The client should permanently use another server.
+ */
SERVER_MOVED(MqttCommonReasonCode.SERVER_MOVED),
+ /**
+ * The server does not support shared subscriptions.
+ */
SHARED_SUBSCRIPTIONS_NOT_SUPPORTED(MqttCommonReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED),
+ /**
+ * The connection is closed because the connection rate is too high.
+ */
CONNECTION_RATE_EXCEEDED(MqttCommonReasonCode.CONNECTION_RATE_EXCEEDED),
+ /**
+ * The maximum connection time authorized for this connection has been exceeded.
+ */
MAXIMUM_CONNECT_TIME(0xA0),
+ /**
+ * The server does not support subscription identifiers.
+ */
SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED(MqttCommonReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED),
+ /**
+ * The server does not support wildcard subscriptions.
+ */
WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED(MqttCommonReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED);
private final int code;
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/Mqtt5PayloadFormatIndicator.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/Mqtt5PayloadFormatIndicator.java
index a92755340..f2c8fe295 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/Mqtt5PayloadFormatIndicator.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/Mqtt5PayloadFormatIndicator.java
@@ -27,7 +27,13 @@
*/
public enum Mqtt5PayloadFormatIndicator {
+ /**
+ * Payload consists of unspecified bytes.
+ */
UNSPECIFIED,
+ /**
+ * Payload consists of UTF-8 encoded character data as defined by the Unicode specification and restated in RFC 3629.
+ */
UTF_8;
/**
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/puback/Mqtt5PubAckReasonCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/puback/Mqtt5PubAckReasonCode.java
index ea4084da9..f7e42ee51 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/puback/Mqtt5PubAckReasonCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/puback/Mqtt5PubAckReasonCode.java
@@ -32,14 +32,42 @@
*/
public enum Mqtt5PubAckReasonCode implements Mqtt5ReasonCode {
+ /**
+ * The message is accepted. Publication of the QoS 1 message proceeds.
+ */
SUCCESS(MqttCommonReasonCode.SUCCESS),
+ /**
+ * The message is accepted but there are no subscribers.
+ */
NO_MATCHING_SUBSCRIBERS(MqttCommonReasonCode.NO_MATCHING_SUBSCRIBERS),
+ /**
+ * The receiver either does not want to reveal the reason for the failure or none of the other reason codes apply.
+ */
UNSPECIFIED_ERROR(MqttCommonReasonCode.UNSPECIFIED_ERROR),
+ /**
+ * The PUBLISH packet is valid but is not accepted by the receiver.
+ */
IMPLEMENTATION_SPECIFIC_ERROR(MqttCommonReasonCode.IMPLEMENTATION_SPECIFIC_ERROR),
+ /**
+ * The sender is not authorized to make the publication.
+ */
NOT_AUTHORIZED(MqttCommonReasonCode.NOT_AUTHORIZED),
+ /**
+ * The topic name is formed correctly but is not accepted by the receiver.
+ */
TOPIC_NAME_INVALID(MqttCommonReasonCode.TOPIC_NAME_INVALID),
+ /**
+ * The packet identifier is already in use. This might indicate a mismatch between the session state on the client
+ * and server.
+ */
PACKET_IDENTIFIER_IN_USE(MqttCommonReasonCode.PACKET_IDENTIFIER_IN_USE),
+ /**
+ * An implementation or administrative imposed limit has been exceeded.
+ */
QUOTA_EXCEEDED(MqttCommonReasonCode.QUOTA_EXCEEDED),
+ /**
+ * The payload does not match the specified payload format indicator.
+ */
PAYLOAD_FORMAT_INVALID(MqttCommonReasonCode.PAYLOAD_FORMAT_INVALID);
private static final @NotNull Mqtt5PubAckReasonCode[] VALUES = values();
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubcomp/Mqtt5PubCompReasonCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubcomp/Mqtt5PubCompReasonCode.java
index e4cd332e0..4c98ec2f2 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubcomp/Mqtt5PubCompReasonCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubcomp/Mqtt5PubCompReasonCode.java
@@ -30,7 +30,14 @@
*/
public enum Mqtt5PubCompReasonCode implements Mqtt5ReasonCode {
+ /**
+ * Packet identifier released. Publication of the QoS 2 message is complete.
+ */
SUCCESS(MqttCommonReasonCode.SUCCESS),
+ /**
+ * The packet identifier is not known. This is not an error during recovery, but at other times indicates a mismatch
+ * between the session state on the client and server.
+ */
PACKET_IDENTIFIER_NOT_FOUND(MqttCommonReasonCode.PACKET_IDENTIFIER_NOT_FOUND);
private final int code;
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubrec/Mqtt5PubRecReasonCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubrec/Mqtt5PubRecReasonCode.java
index a2332b29e..6ea728fa1 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubrec/Mqtt5PubRecReasonCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubrec/Mqtt5PubRecReasonCode.java
@@ -32,14 +32,42 @@
*/
public enum Mqtt5PubRecReasonCode implements Mqtt5ReasonCode {
+ /**
+ * The message is accepted. Publication of the QoS 2 message proceeds.
+ */
SUCCESS(MqttCommonReasonCode.SUCCESS),
+ /**
+ * The message is accepted but there are no subscribers.
+ */
NO_MATCHING_SUBSCRIBERS(MqttCommonReasonCode.NO_MATCHING_SUBSCRIBERS),
+ /**
+ * The receiver either does not want to reveal the reason for the failure or none of the other reason codes apply.
+ */
UNSPECIFIED_ERROR(MqttCommonReasonCode.UNSPECIFIED_ERROR),
+ /**
+ * The PUBLISH packet is valid but is not accepted by the receiver.
+ */
IMPLEMENTATION_SPECIFIC_ERROR(MqttCommonReasonCode.IMPLEMENTATION_SPECIFIC_ERROR),
+ /**
+ * The sender is not authorized to make the publication.
+ */
NOT_AUTHORIZED(MqttCommonReasonCode.NOT_AUTHORIZED),
+ /**
+ * The topic name is formed correctly but is not accepted by the receiver.
+ */
TOPIC_NAME_INVALID(MqttCommonReasonCode.TOPIC_NAME_INVALID),
+ /**
+ * The packet identifier is already in use. This might indicate a mismatch between the session state on the client
+ * and server.
+ */
PACKET_IDENTIFIER_IN_USE(MqttCommonReasonCode.PACKET_IDENTIFIER_IN_USE),
+ /**
+ * An implementation or administrative imposed limit has been exceeded.
+ */
QUOTA_EXCEEDED(MqttCommonReasonCode.QUOTA_EXCEEDED),
+ /**
+ * The payload does not match the specified payload format indicator.
+ */
PAYLOAD_FORMAT_INVALID(MqttCommonReasonCode.PAYLOAD_FORMAT_INVALID);
private static final @NotNull Mqtt5PubRecReasonCode[] VALUES = values();
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubrel/Mqtt5PubRelReasonCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubrel/Mqtt5PubRelReasonCode.java
index 02233cdde..8928dc232 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubrel/Mqtt5PubRelReasonCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/publish/pubrel/Mqtt5PubRelReasonCode.java
@@ -30,7 +30,14 @@
*/
public enum Mqtt5PubRelReasonCode implements Mqtt5ReasonCode {
+ /**
+ * Message released.
+ */
SUCCESS(MqttCommonReasonCode.SUCCESS),
+ /**
+ * The packet identifier is not known. This is not an error during recovery, but at other times indicates a mismatch
+ * between the session state on the client and server.
+ */
PACKET_IDENTIFIER_NOT_FOUND(MqttCommonReasonCode.PACKET_IDENTIFIER_NOT_FOUND);
private final int code;
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/Mqtt5RetainHandling.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/Mqtt5RetainHandling.java
index e36c29421..5c81dd802 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/Mqtt5RetainHandling.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/Mqtt5RetainHandling.java
@@ -27,8 +27,17 @@
*/
public enum Mqtt5RetainHandling {
+ /**
+ * Send retained messages for the current subscription.
+ */
SEND,
+ /**
+ * Send retained messages for the current subscription only if the subscription does not currently exist.
+ */
SEND_IF_SUBSCRIPTION_DOES_NOT_EXIST,
+ /**
+ * Do not send retained messages for the current subscription.
+ */
DO_NOT_SEND;
/**
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/suback/Mqtt5SubAckReasonCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/suback/Mqtt5SubAckReasonCode.java
index d87be7380..1908c0e3d 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/suback/Mqtt5SubAckReasonCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/suback/Mqtt5SubAckReasonCode.java
@@ -30,17 +30,55 @@
*/
public enum Mqtt5SubAckReasonCode implements Mqtt5ReasonCode {
+ /**
+ * The subscription is accepted and the maximum QoS sent will be QoS 0 (this might be a lower QoS than was
+ * requested).
+ */
GRANTED_QOS_0(0x00),
+ /**
+ * The subscription is accepted and the maximum QoS sent will be QoS 1 (this might be a lower QoS than was
+ * requested).
+ */
GRANTED_QOS_1(0x01),
+ /**
+ * The subscription is accepted and the maximum QoS sent will be QoS 2.
+ */
GRANTED_QOS_2(0x02),
+ /**
+ * The server either does not want to reveal the reason for the failure or none of the other reason codes apply.
+ */
UNSPECIFIED_ERROR(MqttCommonReasonCode.UNSPECIFIED_ERROR),
+ /**
+ * The SUBSCRIBE packet is valid but is not accepted by the server.
+ */
IMPLEMENTATION_SPECIFIC_ERROR(MqttCommonReasonCode.IMPLEMENTATION_SPECIFIC_ERROR),
+ /**
+ * The client is not authorized to make the subscription.
+ */
NOT_AUTHORIZED(MqttCommonReasonCode.NOT_AUTHORIZED),
+ /**
+ * The topic filter is formed correctly but is not accepted by the server (for this client).
+ */
TOPIC_FILTER_INVALID(MqttCommonReasonCode.TOPIC_FILTER_INVALID),
+ /**
+ * The specified packet identifier is already in use.
+ */
PACKET_IDENTIFIER_IN_USE(MqttCommonReasonCode.PACKET_IDENTIFIER_IN_USE),
+ /**
+ * An implementation or administrative imposed limit has been exceeded.
+ */
QUOTA_EXCEEDED(MqttCommonReasonCode.QUOTA_EXCEEDED),
+ /**
+ * The server does not support shared subscriptions (for this client).
+ */
SHARED_SUBSCRIPTIONS_NOT_SUPPORTED(MqttCommonReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED),
+ /**
+ * The server does not support subscription identifiers (for this client).
+ */
SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED(MqttCommonReasonCode.SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED),
+ /**
+ * The server does not support wildcard subscriptions (for this client).
+ */
WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED(MqttCommonReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED);
private static final @NotNull Mqtt5SubAckReasonCode[] VALUES = values();
diff --git a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/unsubscribe/unsuback/Mqtt5UnsubAckReasonCode.java b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/unsubscribe/unsuback/Mqtt5UnsubAckReasonCode.java
index cb4e1d159..2d248c873 100644
--- a/src/main/java/com/hivemq/client/mqtt/mqtt5/message/unsubscribe/unsuback/Mqtt5UnsubAckReasonCode.java
+++ b/src/main/java/com/hivemq/client/mqtt/mqtt5/message/unsubscribe/unsuback/Mqtt5UnsubAckReasonCode.java
@@ -30,12 +30,33 @@
*/
public enum Mqtt5UnsubAckReasonCode implements Mqtt5ReasonCode {
+ /**
+ * The subscription is deleted.
+ */
SUCCESS(MqttCommonReasonCode.SUCCESS),
+ /**
+ * No matching topic filter is being used by the client.
+ */
NO_SUBSCRIPTIONS_EXISTED(0x11),
+ /**
+ * The server either does not want to reveal the reason for the failure or none of the other reason codes apply.
+ */
UNSPECIFIED_ERROR(MqttCommonReasonCode.UNSPECIFIED_ERROR),
+ /**
+ * The UNSUBSCRIBE packet is valid but is not accepted by the server.
+ */
IMPLEMENTATION_SPECIFIC_ERROR(MqttCommonReasonCode.IMPLEMENTATION_SPECIFIC_ERROR),
+ /**
+ * The client is not authorized to unsubscribe.
+ */
NOT_AUTHORIZED(MqttCommonReasonCode.NOT_AUTHORIZED),
+ /**
+ * The topic filter is formed correctly but is not accepted by the server (for this client).
+ */
TOPIC_FILTER_INVALID(MqttCommonReasonCode.TOPIC_FILTER_INVALID),
+ /**
+ * The specified packet identifier is already in use.
+ */
PACKET_IDENTIFIER_IN_USE(MqttCommonReasonCode.PACKET_IDENTIFIER_IN_USE);
private static final @NotNull Mqtt5UnsubAckReasonCode[] VALUES = values();
@@ -59,8 +80,8 @@ public int getCode() {
* Returns the UnsubAck Reason Code belonging to the given byte code.
*
* @param code the byte code.
- * @return the UnsubAck Reason Code belonging to the given byte code or null if the byte code is not a valid
- * UnsubAck Reason Code code.
+ * @return the UnsubAck Reason Code belonging to the given byte code or null
if the byte code is not a
+ * valid UnsubAck Reason Code code.
*/
public static @Nullable Mqtt5UnsubAckReasonCode fromCode(final int code) {
for (final Mqtt5UnsubAckReasonCode reasonCode : VALUES) {