Search in sources :

Example 6 with MqttConnectVariableHeader

use of io.netty.handler.codec.mqtt.MqttConnectVariableHeader in project rocketmq-externals by apache.

the class PubSubIntegrationTest method getConnectMessage.

private MqttConnectMessage getConnectMessage(String clientId) {
    MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.CONNECT, false, MqttQoS.AT_MOST_ONCE, false, 0);
    MqttConnectVariableHeader variableHeader = new MqttConnectVariableHeader("MQTT", 4, false, false, false, MqttQoS.AT_MOST_ONCE.value(), true, true, 60);
    MqttConnectPayload payload = new MqttConnectPayload(clientId, "test-will-topic", "the test client is down".getBytes(), null, null);
    return new MqttConnectMessage(fixedHeader, variableHeader, payload);
}
Also used : MqttFixedHeader(io.netty.handler.codec.mqtt.MqttFixedHeader) MqttConnectMessage(io.netty.handler.codec.mqtt.MqttConnectMessage) MqttConnectPayload(io.netty.handler.codec.mqtt.MqttConnectPayload) MqttConnectVariableHeader(io.netty.handler.codec.mqtt.MqttConnectVariableHeader)

Example 7 with MqttConnectVariableHeader

use of io.netty.handler.codec.mqtt.MqttConnectVariableHeader in project thingsboard by thingsboard.

the class MqttTransportHandlerTest method getMqttConnectMessage.

MqttConnectMessage getMqttConnectMessage() {
    MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.CONNECT, true, MqttQoS.AT_LEAST_ONCE, false, 123);
    MqttConnectVariableHeader variableHeader = new MqttConnectVariableHeader("device", packedId.incrementAndGet(), true, true, true, 1, true, false, 60);
    MqttConnectPayload payload = new MqttConnectPayload("clientId", "topic", "message".getBytes(StandardCharsets.UTF_8), "username", "password".getBytes(StandardCharsets.UTF_8));
    return new MqttConnectMessage(mqttFixedHeader, variableHeader, payload);
}
Also used : MqttFixedHeader(io.netty.handler.codec.mqtt.MqttFixedHeader) MqttConnectMessage(io.netty.handler.codec.mqtt.MqttConnectMessage) MqttConnectPayload(io.netty.handler.codec.mqtt.MqttConnectPayload) MqttConnectVariableHeader(io.netty.handler.codec.mqtt.MqttConnectVariableHeader)

Aggregations

MqttConnectMessage (io.netty.handler.codec.mqtt.MqttConnectMessage)7 MqttConnectPayload (io.netty.handler.codec.mqtt.MqttConnectPayload)7 MqttConnectVariableHeader (io.netty.handler.codec.mqtt.MqttConnectVariableHeader)7 MqttFixedHeader (io.netty.handler.codec.mqtt.MqttFixedHeader)6 MqttConnAckVariableHeader (io.netty.handler.codec.mqtt.MqttConnAckVariableHeader)1 MqttMessageIdVariableHeader (io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader)1 MqttPublishVariableHeader (io.netty.handler.codec.mqtt.MqttPublishVariableHeader)1 MqttTopicSubscription (io.netty.handler.codec.mqtt.MqttTopicSubscription)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1