Skip to content

Commit

Permalink
Fix UnitTests
Browse files Browse the repository at this point in the history
  • Loading branch information
chkr1011 committed Apr 1, 2018
1 parent 8f96aca commit 54a0265
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Tests/MQTTnet.Core.Tests/MqttServerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public async Task MqttServer_Publish()
var message = new MqttApplicationMessageBuilder().WithTopic("a").WithAtLeastOnceQoS().Build();
await c1.SubscribeAsync(new TopicFilter("a", MqttQualityOfServiceLevel.AtLeastOnce));

s.PublishAsync(message).Wait();
await s.PublishAsync(message);
await Task.Delay(500);
}
finally
Expand Down
12 changes: 11 additions & 1 deletion Tests/MQTTnet.Core.Tests/TestMqttCommunicationAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,17 @@ public Task<MqttBasePacket> ReceivePacketAsync(TimeSpan timeout, CancellationTok
{
ThrowIfPartnerIsNull();

return Task.Run(() => _incomingPackets.Take(), cancellationToken);
return Task.Run(() =>
{
try
{
return _incomingPackets.Take(cancellationToken);
}
catch
{
return null;
}
}, cancellationToken);
}

private void EnqueuePacketInternal(MqttBasePacket packet)
Expand Down

0 comments on commit 54a0265

Please sign in to comment.