Java terminal emulator
Have a look at the JediTerm project: https://github.com/JetBrains/jediterm
It has both graphical implementation as well as API to override. Graphical version works for remote SSH connections(using JSch) and local pty(using Pty4J).
It is a mature project used for the embedded terminal in JetBrains products.
Telnetd seems to be a complete and pretty well documented solution:
http://telnetd.sourceforge.net/
You can also try:
http://www.jcraft.com/jcterm/
It behaves like a VT100 and uses a SSH2 connection. But the website indicates the VT100 emulation is incomplete.