@Test public void testExecChannelTakesStdinAndNoEchoOfCharsInOuputAndOutlivesClient() throws IOException { SshClient client = setupClient(); ExecChannel response = client.execChannel("cat <<EOF"); client.disconnect(); assertEquals(response.getExitStatus().get(), null); try { PrintStream printStream = new PrintStream(response.getInput()); printStream.append("foo\n"); printStream.append("EOF\n"); printStream.close(); assertEquals(Strings2.toStringAndClose(response.getError()), ""); assertEquals(Strings2.toStringAndClose(response.getOutput()), ""); } finally { Closeables.closeQuietly(response); } assertEquals(response.getExitStatus().get(), Integer.valueOf(0)); } }
@Test public void testExecChannelTakesStdinAndNoEchoOfCharsInOuputAndOutlivesClient() throws IOException { SshClient client = setupClient(); ExecChannel response = client.execChannel("cat <<EOF"); client.disconnect(); assertEquals(response.getExitStatus().get(), null); try { PrintStream printStream = new PrintStream(response.getInput()); printStream.append("foo\n"); printStream.append("EOF\n"); printStream.close(); assertEquals(Strings2.toStringAndClose(response.getError()), ""); assertEquals(Strings2.toStringAndClose(response.getOutput()), ""); } finally { Closeables2.closeQuietly(response); } assertEquals(response.getExitStatus().get(), Integer.valueOf(0)); } }
public void testExecChannelTakesStdinAndNoEchoOfCharsInOuputAndOutlivesClient() throws IOException { SshClient client = setupClient(); ExecChannel response = client.execChannel("cat <<EOF"); client.disconnect(); assertEquals(response.getExitStatus().get(), null); try { PrintStream printStream = new PrintStream(response.getInput()); printStream.append("foo\n"); printStream.append("EOF\n"); printStream.close(); assertEquals(Strings2.toStringAndClose(response.getError()), ""); assertEquals(Strings2.toStringAndClose(response.getOutput()), ""); } finally { Closeables2.closeQuietly(response); } assertEquals(response.getExitStatus().get(), Integer.valueOf(0)); } }