Package com.jcraft.jsch

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


        c.setCommand("scp -f " + path);
        c.connect();
        OutputStream os = c.getOutputStream();
        InputStream is = c.getInputStream();
        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.write(data.getBytes());
        os.flush();
        assertEquals(0, is.read());
        os.write(0);
        os.flush();
        c.disconnect();
    }

    protected void sendFileError(String path, String name, String data) throws Exception {
        ChannelExec c = (ChannelExec) session.openChannel("exec");
        c.setCommand("scp -t " + path);
View Full Code Here

        os.flush();
        assertEquals(0, is.read());
        os.write(data.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");
        c.setCommand("scp -t -r " + path);
View Full Code Here

    final int status = channel.getExitStatus();

    logger.info("exec exit status: " + status);

    channel.disconnect();

    session.disconnect();

    return status;
View Full Code Here

            StringBuffer stdOut = new StringBuffer();
            StringBuffer stdErr = new StringBuffer();
            readSessionOutput(channel, stdOut, stdErr);
        } finally {
            if (channel != null) {
                channel.disconnect();
            }
        }
    }

    /**
 
View Full Code Here

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

            channel.setCommand(cmd);
            sendFile(channel, localFile, remoteTargetName, mode);
            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);
            receiveStream(channel, remoteFile, localTarget);
            channel.disconnect();
        } catch (JSchException e) {
            if (channel != null) {
                channel.disconnect();
            }
            throw (IOException) new IOException("Error during SCP transfer." + e.getMessage())
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

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.