瀏覽代碼

Merge pull request #744 from JanEggers/pr/fix#743

fixed #743
release/3.x.x
Christian 5 年之前
committed by GitHub
父節點
當前提交
22aedcba09
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 3 個檔案被更改,包括 22 行新增1 行删除
  1. +1
    -0
      Build/MQTTnet.nuspec
  2. +0
    -1
      Source/MQTTnet.AspnetCore/SpanBasedMqttPacketWriter.cs
  3. +21
    -0
      Tests/MQTTnet.Core.Tests/MqttPacketSerializer_Tests.cs

+ 1
- 0
Build/MQTTnet.nuspec 查看文件

@@ -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>


+ 0
- 1
Source/MQTTnet.AspnetCore/SpanBasedMqttPacketWriter.cs 查看文件

@@ -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)


+ 21
- 0
Tests/MQTTnet.Core.Tests/MqttPacketSerializer_Tests.cs 查看文件

@@ -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()
{


Loading…
取消
儲存