I am in the process of trying to implement a Java client for RFC 2217, which is the protocol for accessing serial ports over TCP. Unfortunately, the commons-net telnet client is insufficient for this relatively simple task.
There are two missing features in the commons-net telnet client code, one of which is a show stopper and the other of which would be a "real nice to have". This issue documents the first problem:
RFC 2217 specifies that serial port events (such as server notifiying about a change in carrier detect, or the client instructing the server to change the baud rate) are delivered to the peer by subnegotiations. For example, to notify the client about carrier detect, the server sends IAC SB COM-PORT-OPTION NOTIFY-MODEMSTATE <value> IAC SE to the client; to set the serial port baud rate, the client sends IAC SB COM-PORT-OPTION SET-BAUD <value(4)> IAC SE to the server. These messages can happen at any time and are not associated with any WILL/WONT/DO/DONT negotiation (according to my understanding).
The problem is that while one can receive such messages via TelnetOptionHandler.answerSubnegotiation(), the TelnetClient class doesn't provide any way to send (i.e., intiate) these messages.
What's needed here is simply to expose Telnet._sendSubnegotiation() (properly renamed, etc.) as a public method.
I'm going to attempt to come up with a patch and will attach it here if successful.