diff --git a/src/Renci.SshNet/Connection/SshConnector.cs b/src/Renci.SshNet/Connection/SshConnector.cs index 191caa638..81a43b53e 100644 --- a/src/Renci.SshNet/Connection/SshConnector.cs +++ b/src/Renci.SshNet/Connection/SshConnector.cs @@ -24,12 +24,13 @@ public SshConnector(IServiceFactory serviceFactory, ISocketFactory socketFactory public override Socket Connect(IConnectionInfo connectionInfo) { - if (connectionInfo == null) - throw new ArgumentNullException("connectionInfo"); - if (connectionInfo.GetType() != typeof(ConnectionInfo)) + var proxyConnection = connectionInfo.ProxyConnection; + if (proxyConnection == null) + throw new ArgumentNullException("connectionInfo.ProxyConnection"); + if (proxyConnection.GetType() != typeof(ConnectionInfo)) throw new ArgumentException("Expecting connectionInfo to be of type ConnectionInfo"); - _jumpSession = new Session((ConnectionInfo)connectionInfo, ServiceFactory, SocketFactory); + _jumpSession = new Session((ConnectionInfo)proxyConnection, ServiceFactory, SocketFactory); _jumpSession.Connect(); _jumpChannel = new JumpChannel(_jumpSession, connectionInfo.Host, (uint)connectionInfo.Port); return _jumpChannel.Connect();