It is a Java implementation of the Unix expect utility.
ExpectJ can be used for automating interaction with either a process (through stdin / stdout) or a telnet session. It is a Java implementation of the Unix expect utility.
As easy like:
// Create a new ExpectJ object with a timeout of 5s
ExpectJ expectinator = new ExpectJ(5);
// Fork the process
Spawn shell = expectinator.spawn("/bin/sh");
// Talk to it
shell.send("echo Chunder\n");
shell.expect("Chunder");
shell.send("exit\n");
shell.expectClose();
// Done!