diff --git a/test/mqtt_client_base_test.dart b/test/mqtt_client_base_test.dart index d7b8521..44fd133 100644 --- a/test/mqtt_client_base_test.dart +++ b/test/mqtt_client_base_test.dart @@ -525,7 +525,7 @@ void main() { Protocol.version = MqttClientConstants.mqttV31ProtocolVersion; Protocol.name = MqttClientConstants.mqttV31ProtocolName; }); - test('Protocol with connect message', () { + test('Protocol set with connect message', () { Protocol.version = MqttClientConstants.mqttV31ProtocolVersion; Protocol.name = MqttClientConstants.mqttV31ProtocolName; final client = MqttClient('localhost', 'abcd'); @@ -541,6 +541,17 @@ void main() { expect(client.connectionMessage?.variableHeader?.protocolName, MqttClientConstants.mqttV311ProtocolName); }); + test('Protocol set on connect message', () { + Protocol.version = MqttClientConstants.mqttV31ProtocolVersion; + Protocol.name = MqttClientConstants.mqttV31ProtocolName; + expect(Protocol.version, MqttClientConstants.mqttV31ProtocolVersion); + expect(Protocol.name, MqttClientConstants.mqttV31ProtocolName); + MqttConnectMessage() + ..withProtocolName(MqttClientConstants.mqttV311ProtocolName) + ..withProtocolVersion(MqttClientConstants.mqttV311ProtocolVersion); + expect(Protocol.version, MqttClientConstants.mqttV311ProtocolVersion); + expect(Protocol.name, MqttClientConstants.mqttV311ProtocolName); + }); test('Byte Buffer', () { final uBuff = typed.Uint8Buffer(10); final uBuff1 = typed.Uint8Buffer(10);