final ClientSession session = client.connect("localhost", 4222).await().getSession();
session.authPassword("jonathan", "secret");
final ClientChannel channel = session.createChannel("shell");
ByteArrayOutputStream sent = new ByteArrayOutputStream();
PipedOutputStream pipedIn = new TeePipedOutputStream(sent);
channel.setIn(new PipedInputStream(pipedIn));
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
channel.setOut(out);
channel.setErr(err);
channel.open();
pipedIn.write("properties\r\n".getBytes());
pipedIn.flush();
pipedIn.write("exit\r\n".getBytes());
pipedIn.flush();
channel.waitFor(ClientChannel.CLOSED, 0);
channel.close(false);
client.stop();