How to run and read the results of command prompt/telnet from a processing sketch?

I posted my attempt with sockets here, although I wasn’t able to get a connection to the server (in this case Google’s MX server on port 25).

I may have to look into executing telnet commands with a bat script, but I wish I could do it from within a processing sketch if possible.