To disconnect from the telnet server and cleanup any resources invoke the TelnetSession#disconnect method. You should always invoke the TelnetSession#disconnect method after you are finished with the telnet session.
Example
// release connection
session.disconnect();