I am trying to use the telnet client in conjunction with the telnet BINARY option.
However, the commons-net telnet client has ASCII line-ending conversion hard-coded into it! The result is that even in BINARY mode, any occurrence of CR-LF is replaced by your platform's default line ending sequence. So unless you happen to be running Windows, BINARY mode is screwed up. How ironic.
The attached patch works for me: it seems like this line ending conversion that it's doing is not the job of this library. The telnet protocol has CRLF line endings by definition so this is what any user of this client should expect. If the user of this library wants platform-specific line endings then they can wrap their input in a java.io.LineNumberReader.