mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-18 10:26:11 +08:00
Fix cancellation issues when connecting.
This commit is contained in:
@@ -29,14 +29,15 @@ namespace MQTTnet.Tests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(OperationCanceledException))]
|
||||
public async Task Try_Connect_Invalid_Host()
|
||||
{
|
||||
var crossPlatformSocket = new CrossPlatformSocket();
|
||||
|
||||
var cancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(3));
|
||||
var cancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(5));
|
||||
cancellationToken.Token.Register(() => crossPlatformSocket.Dispose());
|
||||
|
||||
await crossPlatformSocket.ConnectAsync("www.google.de", 1234, CancellationToken.None);
|
||||
await crossPlatformSocket.ConnectAsync("www.google.de", 54321, cancellationToken.Token);
|
||||
}
|
||||
|
||||
//[TestMethod]
|
||||
|
||||
Reference in New Issue
Block a user