@Test public void testClose() { SSHService sshService = new SSHServiceImpl(sessionMock, channelExecMock); sshService.close(); verify(channelExecMock).disconnect(); Mockito.verifyNoMoreInteractions(channelExecMock); verify(sessionMock).disconnect(); sshService = new SSHServiceImpl(sessionMock, null); sshService.close(); }
@Override public void close() { if (execChannel != null) { execChannel.disconnect(); execChannel = null; } session.disconnect(); session = null; }
SSHServiceImpl implements SSHService { @Override public void close() { if (execChannel != null) { execChannel.disconnect(); execChannel = null; } session.disconnect(); session = null; } }
SSHServiceImpl implements SSHService { @Override public void close() { if (execChannel != null) { execChannel.disconnect(); execChannel = null; } session.disconnect(); session = null; } SSHServiceImpl(Session session, Channel channel);  SSHServiceImpl(ConnectionDetails details, IdentityKey identityKey, KnownHostsFile knownHostsFile,
                          int connectTimeout, boolean keepContextForExpectCommand, ProxyHTTP proxyHTTP, String allowedCiphers); }
SSHServiceImpl implements SSHService { @Override public void close() { if (execChannel != null) { execChannel.disconnect(); execChannel = null; } session.disconnect(); session = null; } SSHServiceImpl(Session session, Channel channel);  SSHServiceImpl(ConnectionDetails details, IdentityKey identityKey, KnownHostsFile knownHostsFile,
                          int connectTimeout, boolean keepContextForExpectCommand, ProxyHTTP proxyHTTP, String allowedCiphers); @Override CommandResult runShell(
            final String command,
            final String characterSet,
            boolean usePseudoTerminal,
            int connectTimeout,
            int commandTimeout,
            boolean agentForwarding); @Override CommandResult runShellCommand(
            String command,
            String characterSet,
            boolean usePseudoTerminal,
            int connectTimeout,
            int commandTimeout,
            boolean agentForwarding); @Override void createLocalTunnel(int localPort, String remoteHost, int remotePort); @Override boolean isConnected(); @Override void close(); @Override boolean saveToCache(GlobalSessionObject<Map<String, SSHConnection>> sessionParam, String sessionId); @Override void removeFromCache(GlobalSessionObject<Map<String, SSHConnection>> sessionParam, String sessionId); @Override Session getSSHSession(); @Override Channel getExecChannel(); }
SSHServiceImpl implements SSHService { @Override public void close() { if (execChannel != null) { execChannel.disconnect(); execChannel = null; } session.disconnect(); session = null; } SSHServiceImpl(Session session, Channel channel);  SSHServiceImpl(ConnectionDetails details, IdentityKey identityKey, KnownHostsFile knownHostsFile,
                          int connectTimeout, boolean keepContextForExpectCommand, ProxyHTTP proxyHTTP, String allowedCiphers); @Override CommandResult runShell(
            final String command,
            final String characterSet,
            boolean usePseudoTerminal,
            int connectTimeout,
            int commandTimeout,
            boolean agentForwarding); @Override CommandResult runShellCommand(
            String command,
            String characterSet,
            boolean usePseudoTerminal,
            int connectTimeout,
            int commandTimeout,
            boolean agentForwarding); @Override void createLocalTunnel(int localPort, String remoteHost, int remotePort); @Override boolean isConnected(); @Override void close(); @Override boolean saveToCache(GlobalSessionObject<Map<String, SSHConnection>> sessionParam, String sessionId); @Override void removeFromCache(GlobalSessionObject<Map<String, SSHConnection>> sessionParam, String sessionId); @Override Session getSSHSession(); @Override Channel getExecChannel(); static final String EXIT_COMMAND; }