From f7022f0ad790a55cff1e4d0d03658a372b89b110 Mon Sep 17 00:00:00 2001 From: Ayoub Kaanich Date: Thu, 4 Jan 2024 18:31:15 +0100 Subject: [PATCH] Catch IOException in TestUdpTunnel (#498) * Catch IOException in TestUdpTunnel * Catch SystemException to include SocketException as well --- Test/Tunneling/TunnelDeviceTest.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Test/Tunneling/TunnelDeviceTest.cs b/Test/Tunneling/TunnelDeviceTest.cs index 252c254e..b1897086 100644 --- a/Test/Tunneling/TunnelDeviceTest.cs +++ b/Test/Tunneling/TunnelDeviceTest.cs @@ -4,6 +4,7 @@ using SharpPcap.LibPcap; using SharpPcap.Tunneling; using System; +using System.IO; using System.Linq; using System.Net; using System.Net.NetworkInformation; @@ -79,7 +80,14 @@ public void TestUdpTunnel() var nic = TunnelDevice.GetTunnelInterfaces().First(); using var tapDevice = GetTunnelDevice(nic); // Open TAP device first to ensure the virutal device is connected - tapDevice.Open(DeviceModes.Promiscuous); + try + { + tapDevice.Open(DeviceModes.Promiscuous); + } + catch (SystemException ex) + { + Assert.Fail(ex.Message); + } var tapIp = IpHelper.GetIPAddress(nic); using var tester = new UdpTester(tapIp);