Example usage for org.apache.commons.net.telnet TelnetOption getOption

List of usage examples for org.apache.commons.net.telnet TelnetOption getOption

Introduction

In this page you can find the example usage for org.apache.commons.net.telnet TelnetOption getOption.

Prototype

public static final String getOption(int code) 

Source Link

Document

Returns the string representation of the telnet protocol option corresponding to the given option code.

Usage

From source file:org.eclipse.osee.ote.core.test.shells.TelnetShell.java

@Override
public void receivedNegotiation(int negotiationCode, int option) {
    final String negotiationCodeStr;
    switch (negotiationCode) {
    case TelnetNotificationHandler.RECEIVED_DO:
        negotiationCodeStr = "DO";
        break;//from   w  ww .j  a v a2 s  . c  o m
    case TelnetNotificationHandler.RECEIVED_DONT:
        negotiationCodeStr = "DONT";
        break;
    case TelnetNotificationHandler.RECEIVED_WILL:
        negotiationCodeStr = "WILL";
        break;
    case TelnetNotificationHandler.RECEIVED_WONT:
        negotiationCodeStr = "WONT";
        break;
    default:
        throw new Error("unhandled negotiation code of " + negotiationCode);
    }
    System.out.printf("Negotiation recieved: %s for option %s\n", negotiationCodeStr,
            TelnetOption.getOption(option));
}

From source file:org.eclipse.osee.ote.core.test.shells.TelnetShell.java

public void printOptionStates() {
    for (int i = 0; i < TelnetOption.MAX_OPTION_VALUE; i++) {
        String str = TelnetOption.getOption(i);
        if (!str.equals("UNASSIGNED")) {
            boolean local = telnet.getLocalOptionState(i);
            boolean remote = telnet.getRemoteOptionState(i);
            if (local || remote) {
                System.out.printf("%s (%02d): local %b, remote %b\n", TelnetOption.getOption(i), i, local,
                        remote);/* ww  w  .ja  va 2s  .  c  om*/
            }
        }
    }
}