Package com.jcraft.jsch

Examples of com.jcraft.jsch.ChannelExec.disconnect()


        try {
            channel = getExecChannel();
            channel.setCommand(cmd);
            receiveStream(channel, remoteFile, localTarget);
            channel.disconnect();
        } catch (JSchException e) {
            if (channel != null)
                channel.disconnect();
            throw (IOException) new IOException("Error during SCP transfer."+e.getMessage())
                    .initCause(e);
View Full Code Here


            channel.setCommand(cmd);
            receiveStream(channel, remoteFile, localTarget);
            channel.disconnect();
        } catch (JSchException e) {
            if (channel != null)
                channel.disconnect();
            throw (IOException) new IOException("Error during SCP transfer."+e.getMessage())
                    .initCause(e);
        }
    }
   
View Full Code Here

        try {
            channel = getExecChannel();
            channel.setCommand(cmd);
            fileInfo = receiveStream(channel, remoteFile, null);
            channel.disconnect();
        } catch (JSchException e) {
            throw (IOException) new IOException("Error during SCP transfer."+e.getMessage())
            .initCause(e);
        } finally {
            if (channel != null)
View Full Code Here

        } catch (JSchException e) {
            throw (IOException) new IOException("Error during SCP transfer."+e.getMessage())
            .initCause(e);
        } finally {
            if (channel != null)
              channel.disconnect();
        }
        return fileInfo;
    }
}
View Full Code Here

        assertEquals(length, buffer.length);
        assertEquals(0, is.read());
        os.write(0);
        os.flush();

        c.disconnect();
        return new String(buffer);
    }

    protected String readDir(String path) throws Exception {
        ChannelExec c = (ChannelExec) session.openChannel("exec");
View Full Code Here

        os.write(0);
        os.flush();
        header = readLine(is);
        assertEquals("E", header);

        c.disconnect();
        return new String(buffer);
    }

    protected String readFileError(String path) throws Exception {
        ChannelExec c = (ChannelExec) session.openChannel("exec");
View Full Code Here

        OutputStream os = c.getOutputStream();
        InputStream is = c.getInputStream();
        c.setCommand("scp -f " + path);
        c.connect();
        assertEquals(2, is.read());
        c.disconnect();
        return null;
    }

    protected void sendFile(String path, String name, String data) throws Exception {
        ChannelExec c = (ChannelExec) session.openChannel("exec");
View Full Code Here

        os.flush();
        assertEquals(0, is.read());
        os.write(0);
        os.flush();
        Thread.sleep(100);
        c.disconnect();
    }

    protected void sendFileError(String path, String name, String data) throws Exception {
        ChannelExec c = (ChannelExec) session.openChannel("exec");
        OutputStream os = c.getOutputStream();
View Full Code Here

        c.connect();
        assertEquals(0, is.read());
        os.write(("C7777 "+ data.length() + " " + name + "\n").getBytes());
        os.flush();
        assertEquals(2, is.read());
        c.disconnect();
    }

    protected void sendDir(String path, String dirName, String fileName, String data) throws Exception {
        ChannelExec c = (ChannelExec) session.openChannel("exec");
        OutputStream os = c.getOutputStream();
View Full Code Here

                        Thread.currentThread().interrupt();
                        throw new IOException("Interrupted while waiting for SSH command execution", e);
                    }
                }
            } finally {
                channel.disconnect();
                channelCount--;
            }
        }

        @Override
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.