Fail all waiting tasks when the client connection gets closed (#1563)

This commit is contained in:
Christian
2022-11-06 10:50:04 +01:00
committed by GitHub
parent 6e1ec266a7
commit e6c1ab4e4c
10 changed files with 201 additions and 62 deletions
@@ -46,6 +46,22 @@ namespace MQTTnet.Tests.Server
}
}
[TestMethod]
[ExpectedException(typeof(MqttClientDisconnectedException))]
public async Task Disconnect_While_Subscribing()
{
using (var testEnvironment = CreateTestEnvironment())
{
var server = await testEnvironment.StartServer();
// The client will be disconnect directly after subscribing!
server.ClientSubscribedTopicAsync += ev => server.DisconnectClientAsync(ev.ClientId, MqttDisconnectReasonCode.NormalDisconnection);
var client = await testEnvironment.ConnectClient();
await client.SubscribeAsync("#");
}
}
[TestMethod]
public async Task Enqueue_Message_After_Subscription()
{