@@ -24,12 +24,13 @@ public SshConnector(IServiceFactory serviceFactory, ISocketFactory socketFactory
24
24
25
25
public override Socket Connect ( IConnectionInfo connectionInfo )
26
26
{
27
- if ( connectionInfo == null )
28
- throw new ArgumentNullException ( "connectionInfo" ) ;
29
- if ( connectionInfo . GetType ( ) != typeof ( ConnectionInfo ) )
27
+ var proxyConnection = connectionInfo . ProxyConnection ;
28
+ if ( proxyConnection == null )
29
+ throw new ArgumentNullException ( "connectionInfo.ProxyConnection" ) ;
30
+ if ( proxyConnection . GetType ( ) != typeof ( ConnectionInfo ) )
30
31
throw new ArgumentException ( "Expecting connectionInfo to be of type ConnectionInfo" ) ;
31
32
32
- _jumpSession = new Session ( ( ConnectionInfo ) connectionInfo , ServiceFactory , SocketFactory ) ;
33
+ _jumpSession = new Session ( ( ConnectionInfo ) proxyConnection , ServiceFactory , SocketFactory ) ;
33
34
_jumpSession . Connect ( ) ;
34
35
_jumpChannel = new JumpChannel ( _jumpSession , connectionInfo . Host , ( uint ) connectionInfo . Port ) ;
35
36
return _jumpChannel . Connect ( ) ;
@@ -38,12 +39,13 @@ public override Socket Connect(IConnectionInfo connectionInfo)
38
39
#if FEATURE_TAP
39
40
public override async Task < Socket > ConnectAsync ( IConnectionInfo connectionInfo , CancellationToken cancellationToken )
40
41
{
41
- if ( connectionInfo == null )
42
- throw new ArgumentNullException ( "connectionInfo" ) ;
43
- if ( connectionInfo . GetType ( ) != typeof ( ConnectionInfo ) )
42
+ var proxyConnection = connectionInfo . ProxyConnection ;
43
+ if ( proxyConnection == null )
44
+ throw new ArgumentNullException ( "connectionInfo.ProxyConnection" ) ;
45
+ if ( proxyConnection . GetType ( ) != typeof ( ConnectionInfo ) )
44
46
throw new ArgumentException ( "Expecting connectionInfo to be of type ConnectionInfo" ) ;
45
47
46
- _jumpSession = new Session ( ( ConnectionInfo ) connectionInfo , ServiceFactory , SocketFactory ) ;
48
+ _jumpSession = new Session ( ( ConnectionInfo ) proxyConnection , ServiceFactory , SocketFactory ) ;
47
49
await _jumpSession . ConnectAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
48
50
_jumpChannel = new JumpChannel ( _jumpSession , connectionInfo . Host , ( uint ) connectionInfo . Port ) ;
49
51
return _jumpChannel . Connect ( ) ;
0 commit comments