I have looked at several questions here about using Java to drive a telnet session, and although I see some code down at the socket/protocol level, and a few recommendations for this or that telnet library, I don't see sample code or a pointer to sample code for driving a telnet session using one of those libraries. There's no reason why it can't be this easy:
MyTel session = new MyTel("host.myco");
session.start();
session.waitForThenType("login:", "imauser");
session.waitForThenType("Password:","secr3et");
String output = session.waitForThenType("Solaris", "tail MyFile.txt");
session.waitForThenType("%>","exit");
session.end();
// enjoy output here
So, looking for some example code that stays out of the telnet sockets and protocol, but can drive telnet sessions.