The MQTT V3 client allows for an authentication property as part of the connect message. This property consists of a user ID and password. There is no size limitation. The connection fails if the user is not authenticated successfully or is not authorized to connect.
For MQTT V3, use the following:
Parent topic: Micro broker client
MqttProperties props = new MqttProperties();
MqttClient client = clientFactory.createMqttClient("MyClient", "tcp://localhost:1883", props);