diff --git a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs index 0997a32f6..da1018cd0 100644 --- a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs +++ b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs @@ -47,17 +47,17 @@ public static Socket Connect(IPEndPoint remoteEndpoint, TimeSpan connectTimeout) return socket; } - public static void Connect(Socket socket, IPEndPoint remoteEndpoint, TimeSpan connectTimeout) + public static void Connect(Socket socket, EndPoint remoteEndpoint, TimeSpan connectTimeout) { ConnectCore(socket, remoteEndpoint, connectTimeout, ownsSocket: false); } - public static async Task ConnectAsync(Socket socket, IPEndPoint remoteEndpoint, CancellationToken cancellationToken) + public static async Task ConnectAsync(Socket socket, EndPoint remoteEndpoint, CancellationToken cancellationToken) { await socket.ConnectAsync(remoteEndpoint, cancellationToken).ConfigureAwait(false); } - private static void ConnectCore(Socket socket, IPEndPoint remoteEndpoint, TimeSpan connectTimeout, bool ownsSocket) + private static void ConnectCore(Socket socket, EndPoint remoteEndpoint, TimeSpan connectTimeout, bool ownsSocket) { var connectCompleted = new ManualResetEvent(initialState: false); var args = new SocketAsyncEventArgs diff --git a/src/Renci.SshNet/Abstractions/SocketExtensions.cs b/src/Renci.SshNet/Abstractions/SocketExtensions.cs index 03c9b050a..cf8d05f41 100644 --- a/src/Renci.SshNet/Abstractions/SocketExtensions.cs +++ b/src/Renci.SshNet/Abstractions/SocketExtensions.cs @@ -85,7 +85,7 @@ public void GetResult() } } - public static async Task ConnectAsync(this Socket socket, IPEndPoint remoteEndpoint, CancellationToken cancellationToken) + public static async Task ConnectAsync(this Socket socket, EndPoint remoteEndpoint, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/Renci.SshNet/Connection/ConnectorBase.cs b/src/Renci.SshNet/Connection/ConnectorBase.cs index c1b30fb8f..735e88c53 100644 --- a/src/Renci.SshNet/Connection/ConnectorBase.cs +++ b/src/Renci.SshNet/Connection/ConnectorBase.cs @@ -29,25 +29,21 @@ protected ConnectorBase(ISocketFactory socketFactory) public abstract Task ConnectAsync(IConnectionInfo connectionInfo, CancellationToken cancellationToken); /// - /// Establishes a socket connection to the specified host and port. + /// Establishes a socket connection to the specified endpoint. /// - /// The host name of the server to connect to. - /// The port to connect to. + /// The representing the server to connect to. /// The maximum time to wait for the connection to be established. /// The connection failed to establish within the configured . /// An error occurred trying to establish the connection. - protected Socket SocketConnect(string host, int port, TimeSpan timeout) + protected Socket SocketConnect(EndPoint endPoint, TimeSpan timeout) { - var ipAddress = Dns.GetHostAddresses(host)[0]; - var ep = new IPEndPoint(ipAddress, port); + DiagnosticAbstraction.Log(string.Format("Initiating connection to '{0}'.", endPoint)); - DiagnosticAbstraction.Log(string.Format("Initiating connection to '{0}:{1}'.", host, port)); - - var socket = SocketFactory.Create(ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + var socket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); try { - SocketAbstraction.Connect(socket, ep, timeout); + SocketAbstraction.Connect(socket, endPoint, timeout); const int socketBufferSize = 10 * Session.MaximumSshPacketSize; socket.SendBufferSize = socketBufferSize; @@ -62,31 +58,22 @@ protected Socket SocketConnect(string host, int port, TimeSpan timeout) } /// - /// Establishes a socket connection to the specified host and port. + /// Establishes a socket connection to the specified endpoint. /// - /// The host name of the server to connect to. - /// The port to connect to. + /// The representing the server to connect to. /// The cancellation token to observe. /// The connection failed to establish within the configured . /// An error occurred trying to establish the connection. - protected async Task SocketConnectAsync(string host, int port, CancellationToken cancellationToken) + protected async Task SocketConnectAsync(EndPoint endPoint, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); -#if NET6_0_OR_GREATER - var ipAddress = (await Dns.GetHostAddressesAsync(host, cancellationToken).ConfigureAwait(false))[0]; -#else - var ipAddress = (await Dns.GetHostAddressesAsync(host).ConfigureAwait(false))[0]; -#endif - - var ep = new IPEndPoint(ipAddress, port); - - DiagnosticAbstraction.Log(string.Format("Initiating connection to '{0}:{1}'.", host, port)); + DiagnosticAbstraction.Log(string.Format("Initiating connection to '{0}'.", endPoint)); - var socket = SocketFactory.Create(ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + var socket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); try { - await SocketAbstraction.ConnectAsync(socket, ep, cancellationToken).ConfigureAwait(false); + await SocketAbstraction.ConnectAsync(socket, endPoint, cancellationToken).ConfigureAwait(false); const int socketBufferSize = 2 * Session.MaximumSshPacketSize; socket.SendBufferSize = socketBufferSize; diff --git a/src/Renci.SshNet/Connection/DirectConnector.cs b/src/Renci.SshNet/Connection/DirectConnector.cs index f0b1d6d62..bf6db0d73 100644 --- a/src/Renci.SshNet/Connection/DirectConnector.cs +++ b/src/Renci.SshNet/Connection/DirectConnector.cs @@ -1,4 +1,5 @@ -using System.Net.Sockets; +using System.Net; +using System.Net.Sockets; using System.Threading; namespace Renci.SshNet.Connection @@ -12,12 +13,12 @@ public DirectConnector(ISocketFactory socketFactory) public override Socket Connect(IConnectionInfo connectionInfo) { - return SocketConnect(connectionInfo.Host, connectionInfo.Port, connectionInfo.Timeout); + return SocketConnect(new DnsEndPoint(connectionInfo.Host, connectionInfo.Port), connectionInfo.Timeout); } public override System.Threading.Tasks.Task ConnectAsync(IConnectionInfo connectionInfo, CancellationToken cancellationToken) { - return SocketConnectAsync(connectionInfo.Host, connectionInfo.Port, cancellationToken); + return SocketConnectAsync(new DnsEndPoint(connectionInfo.Host, connectionInfo.Port), cancellationToken); } } } diff --git a/src/Renci.SshNet/Connection/ISocketFactory.cs b/src/Renci.SshNet/Connection/ISocketFactory.cs index a12233182..53f9e36d7 100644 --- a/src/Renci.SshNet/Connection/ISocketFactory.cs +++ b/src/Renci.SshNet/Connection/ISocketFactory.cs @@ -8,16 +8,14 @@ namespace Renci.SshNet.Connection internal interface ISocketFactory { /// - /// Creates a with the specified , - /// and that does not use the - /// Nagle algorithm. + /// Creates a with the specified + /// and that does not use the Nagle algorithm. /// - /// The . /// The . /// The . /// /// The . /// - Socket Create(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType); + Socket Create(SocketType socketType, ProtocolType protocolType); } } diff --git a/src/Renci.SshNet/Connection/ProxyConnector.cs b/src/Renci.SshNet/Connection/ProxyConnector.cs index a3f947efa..2e5b715b5 100644 --- a/src/Renci.SshNet/Connection/ProxyConnector.cs +++ b/src/Renci.SshNet/Connection/ProxyConnector.cs @@ -1,4 +1,5 @@ using System; +using System.Net; using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; @@ -52,7 +53,7 @@ Task HandleProxyConnectAsync(IConnectionInfo connectionInfo, Socket socket, Canc /// public override Socket Connect(IConnectionInfo connectionInfo) { - var socket = SocketConnect(connectionInfo.ProxyHost, connectionInfo.ProxyPort, connectionInfo.Timeout); + var socket = SocketConnect(new DnsEndPoint(connectionInfo.ProxyHost, connectionInfo.ProxyPort), connectionInfo.Timeout); try { @@ -78,7 +79,7 @@ public override Socket Connect(IConnectionInfo connectionInfo) /// public override async Task ConnectAsync(IConnectionInfo connectionInfo, CancellationToken cancellationToken) { - var socket = await SocketConnectAsync(connectionInfo.ProxyHost, connectionInfo.ProxyPort, cancellationToken).ConfigureAwait(false); + var socket = await SocketConnectAsync(new DnsEndPoint(connectionInfo.ProxyHost, connectionInfo.ProxyPort), cancellationToken).ConfigureAwait(false); try { diff --git a/src/Renci.SshNet/Connection/SocketFactory.cs b/src/Renci.SshNet/Connection/SocketFactory.cs index 698634947..948c9d380 100644 --- a/src/Renci.SshNet/Connection/SocketFactory.cs +++ b/src/Renci.SshNet/Connection/SocketFactory.cs @@ -7,20 +7,10 @@ namespace Renci.SshNet.Connection /// internal sealed class SocketFactory : ISocketFactory { - /// - /// Creates a with the specified , - /// and that does not use the - /// Nagle algorithm. - /// - /// The . - /// The . - /// The . - /// - /// The . - /// - public Socket Create(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType) + /// + public Socket Create(SocketType socketType, ProtocolType protocolType) { - return new Socket(addressFamily, socketType, protocolType) { NoDelay = true }; + return new Socket(socketType, protocolType) { NoDelay = true }; } } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionRefusedByServer.cs b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionRefusedByServer.cs index 2a0976197..3037134c3 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionRefusedByServer.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionRefusedByServer.cs @@ -26,12 +26,12 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); } protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -95,7 +95,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionSucceeded.cs b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionSucceeded.cs index 433adff45..17d984262 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionSucceeded.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionSucceeded.cs @@ -32,7 +32,7 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _disconnected = false; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _server = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.Port)); _server.Disconnected += (socket) => _disconnected = true; @@ -42,7 +42,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -106,7 +106,7 @@ public void NoBytesShouldHaveBeenReadFromSocket() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_HostNameInvalid.cs b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_HostNameInvalid.cs index 7cd0f6ec6..0a29d70d7 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_HostNameInvalid.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_HostNameInvalid.cs @@ -8,6 +8,7 @@ namespace Renci.SshNet.Tests.Classes.Connection public class DirectConnectorTest_Connect_HostNameInvalid : DirectConnectorTestBase { private ConnectionInfo _connectionInfo; + private Socket _clientSocket; private SocketException _actualException; protected override void SetupData() @@ -16,6 +17,7 @@ protected override void SetupData() _connectionInfo = CreateConnectionInfo("invalid."); _actualException = null; + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); } protected override void Act() @@ -31,6 +33,12 @@ protected override void Act() } } + protected override void SetupMocks() + { + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) + .Returns(_clientSocket); + } + [TestMethod] public void ConnectShouldHaveThrownSocketException() { diff --git a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_TimeoutConnectingToServer.cs b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_TimeoutConnectingToServer.cs index 0aa4a9b8a..82623bc3e 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_TimeoutConnectingToServer.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_TimeoutConnectingToServer.cs @@ -33,12 +33,12 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); } protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -116,7 +116,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs index 5cc4e8d23..fd7d9c72a 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs @@ -36,12 +36,12 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); } protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -105,7 +105,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyClosesConnectionBeforeStatusLineIsSent.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyClosesConnectionBeforeStatusLineIsSent.cs index c6b7939b7..583afa14d 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyClosesConnectionBeforeStatusLineIsSent.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyClosesConnectionBeforeStatusLineIsSent.cs @@ -39,7 +39,7 @@ protected override void SetupData() }; _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += socket => _disconnected = true; @@ -52,7 +52,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -110,7 +110,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyHostInvalid.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyHostInvalid.cs index 8384e4d98..bf9d37d41 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyHostInvalid.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyHostInvalid.cs @@ -9,6 +9,7 @@ public class HttpConnectorTest_Connect_ProxyHostInvalid : HttpConnectorTestBase { private ConnectionInfo _connectionInfo; private SocketException _actualException; + private Socket _clientSocket; protected override void SetupData() { @@ -24,6 +25,13 @@ protected override void SetupData() "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")); _actualException = null; + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); + } + + protected override void SetupMocks() + { + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) + .Returns(_clientSocket); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsEmpty.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsEmpty.cs index e8bf537b8..57ed498b9 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsEmpty.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsEmpty.cs @@ -48,7 +48,7 @@ protected override void SetupData() "\r\n"); _bytesReceivedByProxy = new List(); _disconnected = false; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -72,7 +72,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -131,7 +131,7 @@ public void ClientSocketShouldBeConnected() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsNull.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsNull.cs index 850082049..7fcd9da85 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsNull.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsNull.cs @@ -48,7 +48,7 @@ protected override void SetupData() "\r\n"); _bytesReceivedByProxy = new List(); _disconnected = false; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -72,7 +72,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -131,7 +131,7 @@ public void ClientSocketShouldBeConnected() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseDoesNotContainHttpStatusLine.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseDoesNotContainHttpStatusLine.cs index cca8544a9..e5e9107fe 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseDoesNotContainHttpStatusLine.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseDoesNotContainHttpStatusLine.cs @@ -43,7 +43,7 @@ protected override void SetupData() _bytesReceivedByProxy = new List(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += socket => _disconnected = true; @@ -63,7 +63,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -120,7 +120,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_ExtraTextBeforeStatusLine.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_ExtraTextBeforeStatusLine.cs index f729c6166..829263340 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_ExtraTextBeforeStatusLine.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_ExtraTextBeforeStatusLine.cs @@ -48,7 +48,7 @@ protected override void SetupData() "\r\n"); _bytesReceivedByProxy = new List(); _disconnected = false; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -76,7 +76,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -135,7 +135,7 @@ public void ClientSocketShouldBeConnected() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_HeadersAndContent.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_HeadersAndContent.cs index 955e701a3..48c86128e 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_HeadersAndContent.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_HeadersAndContent.cs @@ -48,7 +48,7 @@ protected override void SetupData() "\r\n"); _bytesReceivedByProxy = new List(); _disconnected = false; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -76,7 +76,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -135,7 +135,7 @@ public void ClientSocketShouldBeConnected() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_OnlyHeaders.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_OnlyHeaders.cs index 7a41263c4..4ce401e0e 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_OnlyHeaders.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_OnlyHeaders.cs @@ -48,7 +48,7 @@ protected override void SetupData() "\r\n"); _bytesReceivedByProxy = new List(); _disconnected = false; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -74,7 +74,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -133,7 +133,7 @@ public void ClientSocketShouldBeConnected() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIsNot200.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIsNot200.cs index fb7f7f9d4..00465a932 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIsNot200.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIsNot200.cs @@ -43,7 +43,7 @@ protected override void SetupData() _bytesReceivedByProxy = new List(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -63,7 +63,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -120,7 +120,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsEmpty.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsEmpty.cs index 453a3f71d..b0efb36f3 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsEmpty.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsEmpty.cs @@ -47,7 +47,7 @@ protected override void SetupData() "\r\n"); _bytesReceivedByProxy = new List(); _disconnected = false; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -73,7 +73,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -126,7 +126,7 @@ public void ClientSocketShouldBeConnected() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNotNullAndNotEmpty.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNotNullAndNotEmpty.cs index de78270fd..0b7c81ccc 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNotNullAndNotEmpty.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNotNullAndNotEmpty.cs @@ -48,7 +48,7 @@ protected override void SetupData() "\r\n"); _bytesReceivedByProxy = new List(); _disconnected = false; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Connected += (socket) => @@ -68,7 +68,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -126,7 +126,7 @@ public void ClientSocketShouldBeConnected() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNull.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNull.cs index 4d9b02679..ab4da5511 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNull.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNull.cs @@ -47,7 +47,7 @@ protected override void SetupData() "\r\n"); _bytesReceivedByProxy = new List(); _disconnected = false; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -73,7 +73,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -131,7 +131,7 @@ public void ClientSocketShouldBeConnected() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs index fbdfeb2c7..0e8b0935e 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs @@ -43,12 +43,12 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); } protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -126,7 +126,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs index c2c56eede..45d9a59e6 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs @@ -56,7 +56,7 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -82,7 +82,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -164,7 +164,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs index 1cd27be56..4610c521c 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs @@ -46,7 +46,7 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += (socket) => _disconnected = true; @@ -58,7 +58,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -134,7 +134,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionRejectedByProxy.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionRejectedByProxy.cs index a220b9423..9a1696267 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionRejectedByProxy.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionRejectedByProxy.cs @@ -30,7 +30,7 @@ protected override void SetupData() _connectionInfo = CreateConnectionInfo("proxyUser", "proxyPwd"); _connectionInfo.Timeout = TimeSpan.FromMilliseconds(100); _bytesReceivedByProxy = new List(); - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _actualException = null; _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); @@ -55,7 +55,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -113,7 +113,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionSucceeded.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionSucceeded.cs index ced5855cb..5b37bfa9e 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionSucceeded.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionSucceeded.cs @@ -33,7 +33,7 @@ protected override void SetupData() _connectionInfo = CreateConnectionInfo("proxyUser", "proxyPwd"); _connectionInfo.Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200)); _bytesReceivedByProxy = new List(); - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _actual = null; _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); @@ -73,7 +73,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -158,7 +158,7 @@ public void ClientSocketShouldBeConnected() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionToProxyRefused.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionToProxyRefused.cs index 7c41d93d0..96e094a1b 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionToProxyRefused.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionToProxyRefused.cs @@ -25,12 +25,12 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); } protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -94,7 +94,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs index 64976c7df..639a603c1 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs @@ -30,13 +30,13 @@ protected override void SetupData() _connectionInfo = CreateConnectionInfo("proxyUser", "proxyPwd"); _connectionInfo.Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200)); _stopWatch = new Stopwatch(); - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _actualException = null; } protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -114,7 +114,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs index d87969ced..efcd02520 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs @@ -36,7 +36,7 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += socket => _disconnected = true; @@ -60,7 +60,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -136,7 +136,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs index 8f6ee9019..92b8843e4 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs @@ -36,7 +36,7 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += socket => _disconnected = true; @@ -56,7 +56,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -132,7 +132,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs index c6d4c65d8..fcb5ffb0c 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs @@ -36,7 +36,7 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += socket => _disconnected = true; @@ -48,7 +48,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -124,7 +124,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ConnectionToProxyRefused.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ConnectionToProxyRefused.cs index 05bd850dc..51d6edda2 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ConnectionToProxyRefused.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ConnectionToProxyRefused.cs @@ -25,12 +25,12 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); } protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -94,7 +94,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_NoAuthentication_ConnectionSucceeded.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_NoAuthentication_ConnectionSucceeded.cs index 58bfa2bb6..2b7931103 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_NoAuthentication_ConnectionSucceeded.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_NoAuthentication_ConnectionSucceeded.cs @@ -31,7 +31,7 @@ protected override void SetupData() _connectionInfo.Timeout = TimeSpan.FromMilliseconds(100); _bytesReceivedByProxy = new List(); - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.BytesReceived += (bytesReceived, socket) => @@ -103,7 +103,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -203,7 +203,7 @@ public void OnlySocksResponseShouldHaveBeenConsumed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ProxySocksVersionIsNotSupported.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ProxySocksVersionIsNotSupported.cs index 1c26de2f6..6a304913a 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ProxySocksVersionIsNotSupported.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ProxySocksVersionIsNotSupported.cs @@ -31,7 +31,7 @@ protected override void SetupData() _proxySocksVersion = GetNotSupportedSocksVersion(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += socket => _disconnected = true; @@ -44,7 +44,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -102,7 +102,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectingToProxy.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectingToProxy.cs index 964e36960..1bf0f80d6 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectingToProxy.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectingToProxy.cs @@ -32,12 +32,12 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); } protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -115,7 +115,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs index 907f4ab6a..40d078546 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs @@ -34,7 +34,7 @@ protected override void SetupData() _stopWatch = new Stopwatch(); _bytesReceivedByProxy = new List(); - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.BytesReceived += (bytesReceived, socket) => @@ -57,7 +57,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -114,7 +114,7 @@ public void ConnectShouldHaveRespectedTimeout() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs index 74d31196e..0d31e3ace 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs @@ -33,7 +33,7 @@ protected override void SetupData() _connectionInfo.Timeout = TimeSpan.FromMilliseconds(100); _bytesReceivedByProxy = new List(); - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += socket => _disconnected = true; @@ -71,7 +71,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -170,7 +170,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs index 3c69ac5c4..50c5aad0a 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs @@ -32,7 +32,7 @@ protected override void SetupData() _connectionInfo.Timeout = TimeSpan.FromMilliseconds(100); _bytesReceivedByProxy = new List(); - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.BytesReceived += (bytesReceived, socket) => @@ -104,7 +104,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -217,7 +217,7 @@ public void OnlySocksResponseShouldHaveBeenConsumed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_PasswordExceedsMaximumLength.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_PasswordExceedsMaximumLength.cs index bb300489d..2ef33b2b4 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_PasswordExceedsMaximumLength.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_PasswordExceedsMaximumLength.cs @@ -33,7 +33,7 @@ protected override void SetupData() _bytesReceivedByProxy = new List(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += socket => _disconnected = true; @@ -58,7 +58,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -142,7 +142,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_UserNameExceedsMaximumLength.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_UserNameExceedsMaximumLength.cs index 83a58f89e..0c847390c 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_UserNameExceedsMaximumLength.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_UserNameExceedsMaximumLength.cs @@ -33,7 +33,7 @@ protected override void SetupData() _bytesReceivedByProxy = new List(); _actualException = null; - _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _clientSocket = SocketFactory.Create(SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); _proxyServer.Disconnected += socket => _disconnected = true; @@ -58,7 +58,7 @@ protected override void SetupData() protected override void SetupMocks() { - _ = SocketFactoryMock.Setup(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + _ = SocketFactoryMock.Setup(p => p.Create(SocketType.Stream, ProtocolType.Tcp)) .Returns(_clientSocket); } @@ -140,7 +140,7 @@ public void ClientSocketShouldHaveBeenDisposed() [TestMethod] public void CreateOnSocketFactoryShouldHaveBeenInvokedOnce() { - SocketFactoryMock.Verify(p => p.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), + SocketFactoryMock.Verify(p => p.Create(SocketType.Stream, ProtocolType.Tcp), Times.Once()); } }