From 8d2a2cd5de40e2b94ef5007c32832ed9a063dc40 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 12 Oct 2023 22:09:49 +0800 Subject: +hazel-networking --- .../Dtls/TestDtlsHandshakeDropUnityConnection.cs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Tools/Hazel-Networking/Hazel.UnitTests/Dtls/TestDtlsHandshakeDropUnityConnection.cs (limited to 'Tools/Hazel-Networking/Hazel.UnitTests/Dtls/TestDtlsHandshakeDropUnityConnection.cs') diff --git a/Tools/Hazel-Networking/Hazel.UnitTests/Dtls/TestDtlsHandshakeDropUnityConnection.cs b/Tools/Hazel-Networking/Hazel.UnitTests/Dtls/TestDtlsHandshakeDropUnityConnection.cs new file mode 100644 index 0000000..f33cd14 --- /dev/null +++ b/Tools/Hazel-Networking/Hazel.UnitTests/Dtls/TestDtlsHandshakeDropUnityConnection.cs @@ -0,0 +1,27 @@ +using Hazel.Dtls; +using System.Net; + +namespace Hazel.UnitTests.Dtls +{ + internal class TestDtlsHandshakeDropUnityConnection : DtlsUnityConnection + { + public int DropSendClientKeyExchangeFlightCount = 0; + + public TestDtlsHandshakeDropUnityConnection(ILogger logger, IPEndPoint remoteEndPoint, IPMode ipMode = IPMode.IPv4) : base(logger, remoteEndPoint, ipMode) + { + + } + + protected override bool DropClientKeyExchangeFlight() + { + if (DropSendClientKeyExchangeFlightCount > 0) + { + this.logger.WriteInfo($"Dropping SendClientKeyExchangeFlight"); + --DropSendClientKeyExchangeFlightCount; + return true; + } + + return false; + } + } +} -- cgit v1.1-26-g67d0