mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-08 08:10:55 +03:00
SSHClient implements Closeable
This commit is contained in:
@@ -61,6 +61,7 @@ import net.schmizz.sshj.xfer.scp.SCPFileTransfer;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
@@ -112,7 +113,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class SSHClient
|
public class SSHClient
|
||||||
extends SocketClient
|
extends SocketClient
|
||||||
implements SessionFactory {
|
implements Closeable, SessionFactory {
|
||||||
|
|
||||||
/** Default port for SSH */
|
/** Default port for SSH */
|
||||||
public static final int DEFAULT_PORT = 22;
|
public static final int DEFAULT_PORT = 22;
|
||||||
@@ -687,4 +688,15 @@ public class SSHClient
|
|||||||
log.info("Key exchange took {} seconds", (System.currentTimeMillis() - start) / 1000.0);
|
log.info("Key exchange took {} seconds", (System.currentTimeMillis() - start) / 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Same as {@link #disconnect()}.
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void close()
|
||||||
|
throws IOException {
|
||||||
|
disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user