Added some TCP wrapper classes for testability

This commit is contained in:
2025-01-28 13:58:01 +01:00
parent 05759f8e12
commit 4ef7500c3b
7 changed files with 185 additions and 7 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Net.Sockets;
namespace AMWD.Protocols.Modbus.Tcp.Utils
{
internal class SocketWrapper : IDisposable
{
private Socket _socket;
public SocketWrapper(Socket socket)
{
_socket = socket;
}
/// <inheritdoc cref="Socket.DualMode" />
public virtual bool DualMode
{
get => _socket.DualMode;
set => _socket.DualMode = value;
}
/// <inheritdoc cref="Socket.IsBound" />
public virtual bool IsBound
=> _socket.IsBound;
public virtual void Dispose()
=> _socket.Dispose();
}
}