Expose client certificate at MQTT connection validator. Make DualMode optional.

This commit is contained in:
Christian Kratky
2019-06-06 19:31:43 +02:00
parent 2b9b22def6
commit 60c6074953
19 changed files with 116 additions and 30 deletions
@@ -1,6 +1,7 @@
using BenchmarkDotNet.Attributes;
using MQTTnet.Packets;
using System;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using MQTTnet.Adapter;
@@ -77,6 +78,8 @@ namespace MQTTnet.Benchmarks
public bool IsSecureConnection { get; } = false;
public X509Certificate2 ClientCertificate { get; }
public void Reset()
{
_position = _buffer.Offset;
@@ -1,5 +1,6 @@
using System;
using System.Collections.Concurrent;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using MQTTnet.Adapter;
@@ -18,6 +19,8 @@ namespace MQTTnet.Tests.Mockups
public bool IsSecureConnection { get; } = false;
public X509Certificate2 ClientCertificate { get; }
public MqttPacketFormatterAdapter PacketFormatterAdapter { get; } = new MqttPacketFormatterAdapter(MqttProtocolVersion.V311);
public long BytesSent { get; }
@@ -39,7 +39,7 @@ namespace MQTTnet.Tests
await Task.Delay(100, ct.Token);
var tcpChannel = new MqttTcpChannel(new NetworkStream(clientSocket, true), "test");
var tcpChannel = new MqttTcpChannel(new NetworkStream(clientSocket, true), "test", null);
var buffer = new byte[1];
await tcpChannel.ReadAsync(buffer, 0, 1, ct.Token);