mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 15:50:57 +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.LoggerFactory;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.SocketAddress;
|
||||
@@ -112,7 +113,7 @@ import java.util.List;
|
||||
*/
|
||||
public class SSHClient
|
||||
extends SocketClient
|
||||
implements SessionFactory {
|
||||
implements Closeable, SessionFactory {
|
||||
|
||||
/** Default port for SSH */
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as {@link #disconnect()}.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void close()
|
||||
throws IOException {
|
||||
disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user