Description
The CONNECT.decode() method from mqtt-client had an issue which has been fixed in https://github.com/fusesource/mqtt-client/pull/31
Wit this fix MQTTProtocolConverter.onConnect() can now check for the condition outlined below and return a CONNACK with return code 0x02.
From MQTT 3.1.1 draft specification
[MQTT-3.1.3-6] A Server MAY allow a Client to supply a ClientId that has a length of zero bytes.
However if it does so the Server MUST treat this as a special case and assign a
unique ClientId to that Client. It MUST then process the CONNECT packet as if
the Client had provided that unique ClientId.
[MQTT-3.1.3-7] If the Client supplies a zero-byte ClientId, the Client MUST also set Clean
Session to 1.
[MQTT-3.1.3-8] If the Client supplies a zero-byte ClientId with Clean Session set to 0, the Server
MUST respond to the CONNECT Packet with a CONNACK return code 0x02
(Identifier rejected) and then close the Network Connection.
[MQTT-3.1.3-9] If the Server rejects the ClientId it MUST respond to the CONNECT Packet with
a CONNACK return code 0x02 (Identifier rejected) and then close the Network
Connection.