Client: IAC (255) WILL (251) CHARSET (42)
Server: IAC SB (250) CHARSET REQUEST (1) UTF-8 IAC SE
Client: IAC SB CHARSET ACCEPTED (2) UTF-8 IAC SE (240)
Client: IAC (255) WILL (251) CHARSET (42)
Server: IAC SB (250) CHARSET REQUEST (1) UTF-8 IAC SE
Charset charset = java.nio.charset.StandardCharsets.US_ASCII;
telnetClient.setCharset(charset);
TelnetOptionHandler simpleOptionHandler = new SimpleOptionHandler(255, true, true, true, true);
telnetClient.connect(host, port);
telnetClient.setCharset(charset);
telnetClient.addOptionHandler(simpleOptionHandler);
int[] responseLocal = simpleOptionHandler.startSubnegotiationLocal();
int[] responseRemote = simpleOptionHandler.startSubnegotiationRemote();
byte command = (byte) 255;
telnetClient.sendCommand(command);
// simpleOptionHandler.answerSubnegotiation();
log.log(Level.INFO, "{0}\t{1}", new Object[]{responseLocal, responseRemote});