Examples of BogusInvertedShell


Examples of org.apache.sshd.util.BogusInvertedShell

public class InvertedShellWrapperTest extends BaseTest {

    @Test
    public void testStreamsAreFlushedBeforeClosing() throws Exception {
        BogusInvertedShell shell = newShell("out", "err");
        shell.setAlive(false);
        ByteArrayInputStream in = new ByteArrayInputStream("in".getBytes());
        ByteArrayOutputStream out = new ByteArrayOutputStream(50);
        ByteArrayOutputStream err = new ByteArrayOutputStream();

        InvertedShellWrapper wrapper = new InvertedShellWrapper(shell);
        wrapper.setInputStream(in);
        wrapper.setOutputStream(out);
        wrapper.setErrorStream(err);
        wrapper.setExitCallback(new BogusExitCallback());
        wrapper.start(new BogusEnvironment());

        wrapper.pumpStreams();

        // check the streams were flushed before exiting
        assertEquals("in", shell.getInputStream().toString());
        assertEquals("out", out.toString());
        assertEquals("err", err.toString());
    }
View Full Code Here

Examples of org.apache.sshd.util.BogusInvertedShell

    private BogusInvertedShell newShell(String contentOut, String contentErr) {
        ByteArrayOutputStream in = new ByteArrayOutputStream(20);
        ByteArrayInputStream out = new ByteArrayInputStream(contentOut.getBytes());
        ByteArrayInputStream err = new ByteArrayInputStream(contentErr.getBytes());
        return new BogusInvertedShell(in, out, err);
    }
View Full Code Here

Examples of org.apache.sshd.util.BogusInvertedShell

public class InvertedShellWrapperTest {

    @Test
    public void testStreamsAreFlushedBeforeClosing() throws Exception {
        BogusInvertedShell shell = newShell("out", "err");
        shell.setAlive(false);
        ByteArrayInputStream in = new ByteArrayInputStream("in".getBytes());
        ByteArrayOutputStream out = new ByteArrayOutputStream(50);
        ByteArrayOutputStream err = new ByteArrayOutputStream();

        InvertedShellWrapper wrapper = new InvertedShellWrapper(shell);
        wrapper.setInputStream(in);
        wrapper.setOutputStream(out);
        wrapper.setErrorStream(err);
        wrapper.setExitCallback(new BogusExitCallback());
        wrapper.start(new BogusEnvironment());

        wrapper.pumpStreams();

        // check the streams were flushed before exiting
        assertEquals("in", shell.getInputStream().toString());
        assertEquals("out", out.toString());
        assertEquals("err", err.toString());
    }
View Full Code Here

Examples of org.apache.sshd.util.BogusInvertedShell

    private BogusInvertedShell newShell(String contentOut, String contentErr) {
        ByteArrayOutputStream in = new ByteArrayOutputStream(20);
        ByteArrayInputStream out = new ByteArrayInputStream(contentOut.getBytes());
        ByteArrayInputStream err = new ByteArrayInputStream(contentErr.getBytes());
        return new BogusInvertedShell(in, out, err);
    }
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.