To end an unresponsive telnet session you first have to get the telnet prompt up. You can do this by pressing the CTRL key and ‘]’. Once the prompt is up enter ‘quit’ and press the return key.
For instructions on how to escape the same situation in ssh follow the link ssh: How to Escape a Dead of Unresponsive Session.