Browse Source

Restore console log of test app

release/3.x.x
Christian Kratky 7 years ago
parent
commit
f85721fbf5
2 changed files with 9 additions and 8 deletions
  1. +7
    -7
      Tests/MQTTnet.TestApp.NetCore/ClientTest.cs
  2. +2
    -1
      Tests/MQTTnet.TestApp.NetCore/ServerTest.cs

+ 7
- 7
Tests/MQTTnet.TestApp.NetCore/ClientTest.cs View File

@@ -17,14 +17,14 @@ namespace MQTTnet.TestApp.NetCore
{ {
ClientId = "XYZ", ClientId = "XYZ",
CleanSession = true, CleanSession = true,
////ChannelOptions = new MqttClientTcpOptions
////{
//// Server = "localhost"
////},
ChannelOptions = new MqttClientWebSocketOptions
ChannelOptions = new MqttClientTcpOptions
{ {
Uri = "localhost"
}
Server = "localhost"
},
////ChannelOptions = new MqttClientWebSocketOptions
////{
//// Uri = "localhost"
////}
}; };


var factory = new MqttFactory(); var factory = new MqttFactory();


+ 2
- 1
Tests/MQTTnet.TestApp.NetCore/ServerTest.cs View File

@@ -49,6 +49,7 @@ namespace MQTTnet.TestApp.NetCore
}); });


var serviceProvider = services.BuildServiceProvider(); var serviceProvider = services.BuildServiceProvider();
serviceProvider.GetRequiredService<ILoggerFactory>().AddConsole();


//var certificate = new X509Certificate(@"C:\certs\test\test.cer", ""); //var certificate = new X509Certificate(@"C:\certs\test\test.cer", "");
//options.TlsEndpointOptions.Certificate = certificate.Export(X509ContentType.Cert); //options.TlsEndpointOptions.Certificate = certificate.Export(X509ContentType.Cert);
@@ -56,7 +57,7 @@ namespace MQTTnet.TestApp.NetCore
//options.DefaultEndpointOptions.IsEnabled = true; //options.DefaultEndpointOptions.IsEnabled = true;
//options.TlsEndpointOptions.IsEnabled = false; //options.TlsEndpointOptions.IsEnabled = false;


var mqttServer = serviceProvider.GetRequiredService<IMqttServer>();
var mqttServer = new MqttFactory(serviceProvider).CreateMqttServer();
mqttServer.ClientDisconnected += (s, e) => mqttServer.ClientDisconnected += (s, e) =>
{ {
Console.Write("Client disconnected event fired."); Console.Write("Client disconnected event fired.");


Loading…
Cancel
Save