Skip to content

Commit

Permalink
Catch IOException in TestUdpTunnel (#498)
Browse files Browse the repository at this point in the history
* Catch IOException in TestUdpTunnel

* Catch SystemException to include SocketException as well
  • Loading branch information
kayoub5 authored Jan 4, 2024
1 parent aeffcde commit f7022f0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Test/Tunneling/TunnelDeviceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f7022f0

Please sign in to comment.