Switched from Moquette's MQTT codec to Netty's MQTT codec ones

This commit is contained in:
andsel
2017-01-28 15:59:44 +01:00
parent 07093ab0cb
commit 1c64186a00
53 changed files with 1571 additions and 1048 deletions
@@ -1,71 +1,71 @@
package io.moquette.interception.messages;
import io.moquette.parser.proto.messages.ConnectMessage;
import io.netty.handler.codec.mqtt.MqttConnectMessage;
/**
* @author Wagner Macedo
*/
public class InterceptConnectMessage extends InterceptAbstractMessage {
private final ConnectMessage msg;
private final MqttConnectMessage msg;
public InterceptConnectMessage(ConnectMessage msg) {
public InterceptConnectMessage(MqttConnectMessage msg) {
super(msg);
this.msg = msg;
}
public String getClientID() {
return msg.getClientID();
return msg.payload().clientIdentifier();
}
public boolean isCleanSession() {
return msg.isCleanSession();
return msg.variableHeader().isCleanSession();
}
public int getKeepAlive() {
return msg.getKeepAlive();
return msg.variableHeader().keepAliveTimeSeconds();
}
public boolean isPasswordFlag() {
return msg.isPasswordFlag();
return msg.variableHeader().hasPassword();
}
public byte getProtocolVersion() {
return msg.getProtocolVersion();
return (byte) msg.variableHeader().version();
}
public String getProtocolName() {
return msg.getProtocolName();
return msg.variableHeader().name();
}
public boolean isUserFlag() {
return msg.isUserFlag();
return msg.variableHeader().hasUserName();
}
public boolean isWillFlag() {
return msg.isWillFlag();
return msg.variableHeader().isWillFlag();
}
public byte getWillQos() {
return msg.getWillQos();
return (byte) msg.variableHeader().willQos();
}
public boolean isWillRetain() {
return msg.isWillRetain();
return msg.variableHeader().isWillRetain();
}
public String getUsername() {
return msg.getUsername();
return msg.payload().userName();
}
public byte[] getPassword() {
return msg.getPassword();
return msg.payload().password().getBytes();
}
public String getWillTopic() {
return msg.getWillTopic();
return msg.payload().willTopic();
}
public byte[] getWillMessage() {
return msg.getWillMessage();
return msg.payload().willMessage().getBytes();
}
}