in src/main/java/org/apache/commons/net/telnet/Telnet.java [369:427]
void processDo(final int option) throws IOException {
if (debugoptions) {
System.err.println("RECEIVED DO: " + TelnetOption.getOption(option));
}
if (notifhand != null) {
notifhand.receivedNegotiation(TelnetNotificationHandler.RECEIVED_DO, option);
}
boolean acceptNewState = false;
/* open TelnetOptionHandler functionality (start) */
if (optionHandlers[option] != null) {
acceptNewState = optionHandlers[option].getAcceptLocal();
} else if (option == TERMINAL_TYPE && terminalType != null && !terminalType.isEmpty()) {
acceptNewState = true;
}
/* TERMINAL-TYPE option (end) */
/* open TelnetOptionHandler functionality (start) */
if (willResponse[option] > 0) {
--willResponse[option];
if (willResponse[option] > 0 && stateIsWill(option)) {
--willResponse[option];
}
}
if (willResponse[option] == 0) {
if (requestedWont(option)) {
switch (option) {
default:
break;
}
if (acceptNewState) {
setWantWill(option);
sendWill(option);
} else {
++willResponse[option];
sendWont(option);
}
} else {
// Other end has acknowledged option.
switch (option) {
default:
break;
}
}
}
setWill(option);
}