diff --git a/src/main/java/com/hivemq/codec/decoder/MQTTMessageDecoder.java b/src/main/java/com/hivemq/codec/decoder/MQTTMessageDecoder.java index f4a6c7331..292657849 100644 --- a/src/main/java/com/hivemq/codec/decoder/MQTTMessageDecoder.java +++ b/src/main/java/com/hivemq/codec/decoder/MQTTMessageDecoder.java @@ -124,6 +124,7 @@ protected void decode( final MessageType messageType = getMessageType(fixedHeader); final @Nullable Message message; + if (messageType == CONNECT) { message = handleConnect(buf, clientConnectionContext, fixedHeader, packetSize, remainingLength); } else { diff --git a/src/test/java/com/hivemq/codec/decoder/MQTTMessageDecoderTest.java b/src/test/java/com/hivemq/codec/decoder/MQTTMessageDecoderTest.java index e802e891b..1aa8e89f7 100644 --- a/src/test/java/com/hivemq/codec/decoder/MQTTMessageDecoderTest.java +++ b/src/test/java/com/hivemq/codec/decoder/MQTTMessageDecoderTest.java @@ -179,7 +179,7 @@ public void test_second_connect_received() { @Test public void test_connect_mqtt5_packet_size_too_large() { - final byte[] mqtt5_connect = { + final byte[] mqtt5Connect = { // fixed header // type, reserved 0b0001_0000, @@ -200,12 +200,12 @@ public void test_connect_mqtt5_packet_size_too_large() { // client identifier 0, 4, 't', 'e', 's', 't'}; - test_connect_packet_size_too_large(mqtt5_connect); + test_connect_packet_size_too_large(mqtt5Connect); } @Test public void test_connect_mqtt3_1_1_packet_size_too_large() { - final byte[] mqtt3_1_1_connect = { + final byte[] mqtt311Connect = { // fixed header // type, reserved 0b0001_0000, @@ -226,12 +226,12 @@ public void test_connect_mqtt3_1_1_packet_size_too_large() { // client identifier 0, 4, 't', 'e', 's', 't'}; - test_connect_packet_size_too_large(mqtt3_1_1_connect); + test_connect_packet_size_too_large(mqtt311Connect); } @Test public void test_connect_mqtt3_1_packet_size_too_large() { - final byte[] mqtt3_1_connect = { + final byte[] mqtt31Connect = { // fixed header // type, reserved 0b0001_0000, @@ -252,7 +252,7 @@ public void test_connect_mqtt3_1_packet_size_too_large() { // client identifier 0, 4, 't', 'e', 's', 't'}; - test_connect_packet_size_too_large(mqtt3_1_connect); + test_connect_packet_size_too_large(mqtt31Connect); }