w.print("This is a second line of text!\r\n");
w.print("Just for fun, a third line!\r\n");
w.flush();
System.out.println("Now waiting for one incoming line of text.");
Reader r = new InputStreamReader(new ChannelInputStream(channel));
while (true) {
int c = r.read();
if (c >= 32) System.out.write(c);
if (c == '\n') break;
}