Package org.apache.sshd.client.channel

Examples of org.apache.sshd.client.channel.ChannelExec


        registerChannel(channel);
        return channel;
    }

    public ChannelExec createExecChannel(String command) throws Exception {
        ChannelExec channel = new ChannelExec(command);
        registerChannel(channel);
        return channel;
    }
View Full Code Here


    public void testCommandDeadlock() throws Exception {
        SshClient client = SshClient.setUpDefaultClient();
        client.start();
        ClientSession session = client.connect("localhost", port).await().getSession();
        session.authPassword("smx", "smx").await().isSuccess();
        ChannelExec channel = session.createExecChannel("test");
        channel.setOut(new NoCloseOutputStream(System.out));
        channel.setErr(new NoCloseOutputStream(System.err));
        channel.open().await();
        Thread.sleep(100);
        try {
            for (int i = 0; i < 100; i++) {
                channel.getInvertedIn().write("a".getBytes());
                channel.getInvertedIn().flush();
            }
        } catch (SshException e) {
            // That's ok, the channel is being closed by the other side
        }
        assertEquals(ChannelExec.CLOSED, channel.waitFor(ChannelExec.CLOSED, 0) & ChannelExec.CLOSED);
        session.close(false).await();
        client.stop();
    }
View Full Code Here

        getConnectionService().registerChannel(channel);
        return channel;
    }

    public ChannelExec createExecChannel(String command) throws IOException {
        ChannelExec channel = new ChannelExec(command);
        getConnectionService().registerChannel(channel);
        return channel;
    }
View Full Code Here

        registerChannel(channel);
        return channel;
    }

    public ChannelExec createExecChannel(String command) throws Exception {
        ChannelExec channel = new ChannelExec(command);
        registerChannel(channel);
        return channel;
    }
View Full Code Here

        // TODO: use NamedFactory to create channel
        AbstractClientChannel channel;
        if (ClientChannel.CHANNEL_SHELL.equals(type)) {
            channel = new ChannelShell();
        } else if (ClientChannel.CHANNEL_EXEC.equals(type)) {
            channel = new ChannelExec();
        } else {
            throw new IllegalArgumentException("Unsupported channel type " + type);
        }
        registerChannel(channel);
        return channel;
View Full Code Here

        registerChannel(channel);
        return channel;
    }

    public ChannelExec createExecChannel(String command) throws Exception {
        ChannelExec channel = new ChannelExec(command);
        registerChannel(channel);
        return channel;
    }
View Full Code Here

        // TODO: use NamedFactory to create channel
        AbstractClientChannel channel;
        if (ClientChannel.CHANNEL_SHELL.equals(type)) {
            channel = new ChannelShell();
        } else if (ClientChannel.CHANNEL_EXEC.equals(type)) {
            channel = new ChannelExec();
        } else {
            throw new IllegalArgumentException("Unsupported channel type " + type);
        }
        int id = ++nextChannelId;
        channel.init(this, id);
View Full Code Here

        // TODO: use NamedFactory to create channel
        AbstractClientChannel channel;
        if (ClientChannel.CHANNEL_SHELL.equals(type)) {
            channel = new ChannelShell();
        } else if (ClientChannel.CHANNEL_EXEC.equals(type)) {
            channel = new ChannelExec();
        } else {
            throw new IllegalArgumentException("Unsupported channel type " + type);
        }
        int id = ++nextChannelId;
        channel.init(this, id);
View Full Code Here

        registerChannel(channel);
        return channel;
    }

    public ChannelExec createExecChannel(String command) throws Exception {
        ChannelExec channel = new ChannelExec(command);
        registerChannel(channel);
        return channel;
    }
View Full Code Here

    public void testCommandDeadlock() throws Exception {
        SshClient client = SshClient.setUpDefaultClient();
        client.start();
        ClientSession session = client.connect("localhost", port).await().getSession();
        session.authPassword("smx", "smx").await().isSuccess();
        ChannelExec channel = session.createExecChannel("test");
        channel.setOut(new NoCloseOutputStream(System.out));
        channel.setErr(new NoCloseOutputStream(System.err));
        channel.open().await();
        Thread.sleep(100);
        try {
            for (int i = 0; i < 100; i++) {
                channel.getInvertedIn().write("a".getBytes());
                channel.getInvertedIn().flush();
            }
        } catch (SshException e) {
            // That's ok, the channel is being closed by the other side
        }
        assertEquals(ChannelExec.CLOSED, channel.waitFor(ChannelExec.CLOSED, 0) & ChannelExec.CLOSED);
        session.close(false).await();
        client.stop();
    }
View Full Code Here

TOP

Related Classes of org.apache.sshd.client.channel.ChannelExec

Copyright © 2018 www.massapicom. 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.