use of com.jn.agileway.ssh.client.impl.sshj.verifier.ToSshjHostKeyVerifierAdapter in project agileway by fangjinuo.
the class SshjConnection method connect.
@Override
public void connect(InetAddress host, int port, InetAddress localAddr, int localPort) throws SshException {
try {
makeSureSshClient();
if (!sshClient.isConnected()) {
if (!this.hostKeyVerifier.isEmpty()) {
sshClient.addHostKeyVerifier(new ToSshjHostKeyVerifierAdapter(this.hostKeyVerifier));
}
if (localAddr == null || !Nets.isValidPort(localPort)) {
sshClient.connect(host, port);
} else {
sshClient.connect(host, port, localAddr, localPort);
}
}
setStatus(SshConnectionStatus.CONNECTED);
} catch (Throwable ex) {
throw new SshException(ex);
}
}
Aggregations