This commit is contained in:
JanEggers
2019-08-14 22:29:51 +02:00
parent 2320352124
commit a4420063c0
3 changed files with 22 additions and 1 deletions
+1
View File
@@ -17,6 +17,7 @@
* [Server] Refactoring of server certificate password classes (BREAKING CHANGE!).
* [Server] Fixed an issue with empty server certificate passwords (thanks to @SeppPenner).
* [MQTTnet.Server] Added support for certificate passwords (BREAKING CHANGE IN CONFIG!)
* [MQTTnet.AspNetCore] fixed an issue with mqtt V5 package serialization (#743)
</releaseNotes>
<copyright>Copyright Christian Kratky 2016-2019</copyright>
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>
@@ -64,7 +64,6 @@ namespace MQTTnet.AspNetCore
GrowIfNeeded(propertyWriter.Length);
Write(propertyWriter.GetBuffer(), 0, propertyWriter.Length);
Commit(propertyWriter.Length);
}
public void Write(byte[] payload, int start, int length)
@@ -8,6 +8,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using MQTTnet.Adapter;
using MQTTnet.Formatter;
using MQTTnet.Formatter.V3;
using MQTTnet.Formatter.V5;
using MQTTnet.Internal;
using MQTTnet.Packets;
using MQTTnet.Protocol;
@@ -258,6 +259,26 @@ namespace MQTTnet.Tests
Assert.IsTrue(deserialized.Properties.UserProperties.Any(x => x.Name == "Foo"));
}
[TestMethod]
public void SerializeV500_MqttPublishPacket_CorrelationData()
{
var data = "123456789";
var req = new MqttApplicationMessageBuilder()
.WithTopic("Foo")
.WithResponseTopic($"_")
.WithCorrelationData(Guid.NewGuid().ToByteArray())
.WithPayload(data)
.WithQualityOfServiceLevel(MqttQualityOfServiceLevel.AtMostOnce)
.Build();
var p = new MqttV500DataConverter().CreatePublishPacket(req);
var deserialized = Roundtrip(p, MqttProtocolVersion.V500);
Assert.IsTrue(p.Payload.SequenceEqual(deserialized.Payload));
}
[TestMethod]
public void DeserializeV311_MqttPublishPacket()
{