use of com.jn.agileway.ssh.client.impl.ganymedssh2.verifier.ToSsh2HostKeyVerifierAdapter in project agileway by fangjinuo.
the class Ssh2Connection method connect.
@Override
public void connect(InetAddress host, int port, InetAddress localAddr, int localPort) throws SshException {
try {
if (delegate == null) {
Socket localSocket = null;
if (localAddr != null && Nets.isValidPort(localPort)) {
localSocket = new Socket(localAddr, localPort);
}
Connection conn = new Connection(host.getHostName(), port, localSocket);
if (this.hostKeyVerifier.isEmpty()) {
conn.connect();
} else {
conn.connect(new ToSsh2HostKeyVerifierAdapter(this.hostKeyVerifier));
}
setStatus(SshConnectionStatus.CONNECTED);
this.delegate = conn;
}
} catch (Throwable ex) {
throw new SshException(ex);
}
}
use of com.jn.agileway.ssh.client.impl.ganymedssh2.verifier.ToSsh2HostKeyVerifierAdapter in project agileway by fangjinuo.
the class Ssh2Connection method connect.
@Override
public void connect(InetAddress host, int port, InetAddress localAddr, int localPort) throws SshException {
try {
if (delegate == null) {
Connection conn = new Connection(host.getHostName(), port);
if (this.hostKeyVerifier.isEmpty()) {
conn.connect();
} else {
conn.connect(new ToSsh2HostKeyVerifierAdapter(this.hostKeyVerifier));
}
setStatus(SshConnectionStatus.CONNECTED);
this.delegate = conn;
}
} catch (Throwable ex) {
throw new SshException(ex);
}
}
Aggregations