Skip to content

Commit f7022f0

Browse files
authored
Catch IOException in TestUdpTunnel (#498)
* Catch IOException in TestUdpTunnel * Catch SystemException to include SocketException as well
1 parent aeffcde commit f7022f0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Test/Tunneling/TunnelDeviceTest.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using SharpPcap.LibPcap;
55
using SharpPcap.Tunneling;
66
using System;
7+
using System.IO;
78
using System.Linq;
89
using System.Net;
910
using System.Net.NetworkInformation;
@@ -79,7 +80,14 @@ public void TestUdpTunnel()
7980
var nic = TunnelDevice.GetTunnelInterfaces().First();
8081
using var tapDevice = GetTunnelDevice(nic);
8182
// Open TAP device first to ensure the virutal device is connected
82-
tapDevice.Open(DeviceModes.Promiscuous);
83+
try
84+
{
85+
tapDevice.Open(DeviceModes.Promiscuous);
86+
}
87+
catch (SystemException ex)
88+
{
89+
Assert.Fail(ex.Message);
90+
}
8391
var tapIp = IpHelper.GetIPAddress(nic);
8492

8593
using var tester = new UdpTester(tapIp);

0 commit comments

Comments
 (0)