mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 02:53:06 +08:00
Refactor subscribe and unsubscribe to support MQTTv5.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using MQTTnet.Exceptions;
|
||||
using MQTTnet.Formatter;
|
||||
using MQTTnet.Internal;
|
||||
|
||||
@@ -11,12 +11,13 @@ namespace MQTTnet.Tests
|
||||
public class MqttPacketReaderTests
|
||||
{
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(MqttCommunicationClosedGracefullyException))]
|
||||
public void MqttPacketReader_EmptyStream()
|
||||
public async Task MqttPacketReader_EmptyStream()
|
||||
{
|
||||
var fixedHeader = new byte[2];
|
||||
var reader = new MqttPacketReader(new TestMqttChannel(new MemoryStream()));
|
||||
reader.ReadFixedHeaderAsync(fixedHeader, CancellationToken.None).GetAwaiter().GetResult();
|
||||
var readResult = await reader.ReadFixedHeaderAsync(fixedHeader, CancellationToken.None);
|
||||
|
||||
Assert.IsTrue(readResult.ConnectionClosed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user