|
@@ -105,7 +105,7 @@ namespace MQTTnet.Tests.Mockups |
|
|
Server = new TestServerWrapper(_mqttFactory.CreateMqttServer(ServerLogger), TestContext, this); |
|
|
Server = new TestServerWrapper(_mqttFactory.CreateMqttServer(ServerLogger), TestContext, this); |
|
|
|
|
|
|
|
|
options.WithDefaultEndpointPort(ServerPort); |
|
|
options.WithDefaultEndpointPort(ServerPort); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Server.StartAsync(options.Build()).ConfigureAwait(false); |
|
|
await Server.StartAsync(options.Build()).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
return Server; |
|
|
return Server; |
|
@@ -118,7 +118,7 @@ namespace MQTTnet.Tests.Mockups |
|
|
|
|
|
|
|
|
public Task<ILowLevelMqttClient> ConnectLowLevelClientAsync() |
|
|
public Task<ILowLevelMqttClient> ConnectLowLevelClientAsync() |
|
|
{ |
|
|
{ |
|
|
return ConnectLowLevelClientAsync(o => {}); |
|
|
|
|
|
|
|
|
return ConnectLowLevelClientAsync(o => { }); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<ILowLevelMqttClient> ConnectLowLevelClientAsync(Action<MqttClientOptionsBuilder> optionsBuilder) |
|
|
public async Task<ILowLevelMqttClient> ConnectLowLevelClientAsync(Action<MqttClientOptionsBuilder> optionsBuilder) |
|
@@ -160,7 +160,7 @@ namespace MQTTnet.Tests.Mockups |
|
|
|
|
|
|
|
|
return client; |
|
|
return client; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<IMqttClient> ConnectClientAsync(IMqttClientOptions options) |
|
|
public async Task<IMqttClient> ConnectClientAsync(IMqttClientOptions options) |
|
|
{ |
|
|
{ |
|
|
if (options == null) throw new ArgumentNullException(nameof(options)); |
|
|
if (options == null) throw new ArgumentNullException(nameof(options)); |
|
@@ -170,7 +170,7 @@ namespace MQTTnet.Tests.Mockups |
|
|
|
|
|
|
|
|
return client; |
|
|
return client; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ThrowIfLogErrors() |
|
|
public void ThrowIfLogErrors() |
|
|
{ |
|
|
{ |
|
|
lock (_serverErrors) |
|
|
lock (_serverErrors) |
|
@@ -198,7 +198,7 @@ namespace MQTTnet.Tests.Mockups |
|
|
{ |
|
|
{ |
|
|
mqttClient.DisconnectAsync().GetAwaiter().GetResult(); |
|
|
mqttClient.DisconnectAsync().GetAwaiter().GetResult(); |
|
|
} |
|
|
} |
|
|
catch (ObjectDisposedException) |
|
|
|
|
|
|
|
|
catch |
|
|
{ |
|
|
{ |
|
|
// This can happen when the test already disconnected the client. |
|
|
// This can happen when the test already disconnected the client. |
|
|
} |
|
|
} |
|
@@ -208,8 +208,18 @@ namespace MQTTnet.Tests.Mockups |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Server?.StopAsync().GetAwaiter().GetResult(); |
|
|
|
|
|
Server?.Dispose(); |
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
Server?.StopAsync().GetAwaiter().GetResult(); |
|
|
|
|
|
} |
|
|
|
|
|
catch |
|
|
|
|
|
{ |
|
|
|
|
|
// This can happen when the test already stopped the server. |
|
|
|
|
|
} |
|
|
|
|
|
finally |
|
|
|
|
|
{ |
|
|
|
|
|
Server?.Dispose(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
ThrowIfLogErrors(); |
|
|
ThrowIfLogErrors(); |
|
|
|
|
|
|
|
|