/// <summary>Initialize SSH session</summary> /// <exception cref="NGit.Errors.TransportException">in case of error with opening SSH session /// </exception> protected internal virtual void InitSession() { if (sock != null) { return; } int tms = GetTimeout() > 0 ? GetTimeout() * 1000 : 0; string user = uri.GetUser(); string pass = uri.GetPass(); string host = uri.GetHost(); int port = uri.GetPort(); try { sock = sch.GetSession(user, pass, host, port, GetCredentialsProvider(), local.FileSystem ); if (!sock.IsConnected()) { sock.Connect(tms); } } catch (JSchException je) { Exception c = je.InnerException; if (c is UnknownHostException) { throw new TransportException(uri, JGitText.Get().unknownHost); } if (c is ConnectException) { throw new TransportException(uri, c.Message); } throw new TransportException(uri, je.Message, je); } }