using Hazel.Dtls;
+using Hazel.Udp;
+using Hazel.Udp.FewerThreads;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Net;
using System.Security.Cryptography;
namespace Hazel.UnitTests.Dtls
{
[TestClass]
- public class ConnectionTests
+ public class ConnectionTests : BaseThreadLimitedUdpConnectionTests
{
// Created with command line
// openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 100000 -out certificate.pem
return clientCertificates;
}
+ protected override ThreadLimitedUdpConnectionListener CreateListener(int numWorkers, IPEndPoint endPoint, ILogger logger, IPMode ipMode = IPMode.IPv4)
+ {
+ DtlsConnectionListener listener = new DtlsConnectionListener(2, endPoint, logger, ipMode);
+ listener.SetCertificate(GetCertificateForServer());
+ return listener;
+
+ }
+
+ protected override UdpConnection CreateConnection(IPEndPoint endPoint, ILogger logger, IPMode ipMode = IPMode.IPv4)
+ {
+ DtlsUnityConnection connection = new DtlsUnityConnection(logger, endPoint, ipMode);
+ connection.SetValidServerCertificates(GetCertificateForClient());
+ return connection;
+ }
+
[TestMethod]
public void TestClientConnects()
{