Example usage for org.apache.commons.net.telnet TelnetNotificationHandler RECEIVED_DONT

List of usage examples for org.apache.commons.net.telnet TelnetNotificationHandler RECEIVED_DONT

Introduction

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

Prototype

int RECEIVED_DONT

To view the source code for org.apache.commons.net.telnet TelnetNotificationHandler RECEIVED_DONT.

Click Source Link

Document

The remote party sent a DONT command.

Usage

From source file:com.kz.pipeCutter.MyTelnetClient.java

/***
 * Callback method called when TelnetClient receives an option negotiation
 * command./*from  w  w w.j a  v a 2  s  . c om*/
 * <p>
 * 
 * @param negotiation_code
 *          - type of negotiation command received (RECEIVED_DO,
 *          RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT)
 *          <p>
 * @param option_code
 *          - code of the option negotiated
 *          <p>
 ***/
// @Override
public void receivedNegotiation(int negotiation_code, int option_code) {
    String command = null;
    if (negotiation_code == TelnetNotificationHandler.RECEIVED_DO) {
        command = "DO";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_DONT) {
        command = "DONT";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WILL) {
        command = "WILL";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WONT) {
        command = "WONT";
    }
    System.out.println("Received " + command + " for option code " + option_code);
}

From source file:io.termd.core.telnet.TelnetHandlerTest.java

@Test
public void testWillUnknownOption() throws Exception {
    server.start(TelnetHandler::new);
    client.registerNotifHandler((negotiation_code, option_code) -> {
        if (option_code == 47) {
            assertEquals(TelnetNotificationHandler.RECEIVED_DONT, negotiation_code);
            testComplete();//from   w  w  w .j  a  va 2  s  .c o  m
        }
    });
    client.setOptionHandler(new SimpleOptionHandler(47, true, false, false, false));
    client.connect("localhost", 4000);
    await();
}

From source file:collabedit.Telnet.java

/***
 * Callback method called when TelnetClient receives an option negotiation
 * command.//from   www . j  ava2 s  .  c  o  m
 * <p>
 * 
 * @param negotiation_code
 *            - type of negotiation command received (RECEIVED_DO,
 *            RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT)
 *            <p>
 * @param option_code
 *            - code of the option negotiated
 *            <p>
 ***/
// @Override
public void receivedNegotiation(int negotiation_code, int option_code) {
    String command = null;
    if (negotiation_code == TelnetNotificationHandler.RECEIVED_DO) {
        command = "DO";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_DONT) {
        command = "DONT";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WILL) {
        command = "WILL";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WONT) {
        command = "WONT";
    }
    System.out.println("Message Received");
    // System.out.println("Received " + command + " for option code "
    // + option_code);
}

From source file:ch.unizh.ini.jaer.projects.gesture.vlccontrol.TelnetClientExample.java

/***
 * Callback method called when TelnetClient receives an option
 * negotiation command./*from w w w .j  ava  2 s .  co  m*/
 * <p>
 * @param negotiation_code - type of negotiation command received
 * (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT)
 * <p>
 * @param option_code - code of the option negotiated
 * <p>
 ***/
public void receivedNegotiation(int negotiation_code, int option_code) {
    String command = null;
    if (negotiation_code == TelnetNotificationHandler.RECEIVED_DO) {
        command = "DO";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_DONT) {
        command = "DONT";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WILL) {
        command = "WILL";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WONT) {
        command = "WONT";
    }
    System.out.println("Received " + command + " for option code " + option_code);
}

From source file:com.groupC1.control.network.TelnetClientExample.java

/***
 * Callback method called when TelnetClient receives an option
 * negotiation command./*from ww  w. j  av  a  2s .c o  m*/
 * <p>
 * @param negotiation_code - type of negotiation command received
 * (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT)
 * <p>
 * @param option_code - code of the option negotiated
 * <p>
 ***/
//    @Override
public void receivedNegotiation(int negotiation_code, int option_code) {
    String command = null;
    if (negotiation_code == TelnetNotificationHandler.RECEIVED_DO) {
        command = "DO";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_DONT) {
        command = "DONT";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WILL) {
        command = "WILL";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WONT) {
        command = "WONT";
    }
    System.out.println("Received " + command + " for option code " + option_code);
}

From source file:ch.unizh.ini.jaer.projects.gesture.vlccontrol.VLCControl.java

/***
 * Callback method called when TelnetClient receives an option
 * negotiation command.//from w  w  w  . ja va2 s  . co m
 * <p>
 * @param negotiation_code - type of negotiation command received
 * (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT)
 * <p>
 * @param option_code - code of the option negotiated
 * <p>
 ***/
@Override
public void receivedNegotiation(int negotiation_code, int option_code) {
    String command = null;
    if (negotiation_code == TelnetNotificationHandler.RECEIVED_DO) {
        command = "DO";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_DONT) {
        command = "DONT";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WILL) {
        command = "WILL";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WONT) {
        command = "WONT";
    }
    log.log(Level.INFO, "Received {0} for option code {1}", new Object[] { command, option_code });
}

From source file:correospingtelnet.Telnet.java

/***
 * Callback method called when TelnetClient receives an option
 * negotiation command.//from w w w . j a  va 2s . c o  m
 *
 * @param negotiation_code - type of negotiation command received
 * (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT, RECEIVED_COMMAND)
 * @param option_code - code of the option negotiated
 ***/
@Override
public void receivedNegotiation(int negotiation_code, int option_code) {
    String command = null;
    switch (negotiation_code) {
    case TelnetNotificationHandler.RECEIVED_DO:
        command = "DO";
        break;
    case TelnetNotificationHandler.RECEIVED_DONT:
        command = "DONT";
        break;
    case TelnetNotificationHandler.RECEIVED_WILL:
        command = "WILL";
        break;
    case TelnetNotificationHandler.RECEIVED_WONT:
        command = "WONT";
        break;
    case TelnetNotificationHandler.RECEIVED_COMMAND:
        command = "COMMAND";
        break;
    default:
        command = Integer.toString(negotiation_code); // Should not happen
        break;
    }
    System.out.println("Received " + command + " for option code " + option_code);
}

From source file:com.symbian.driver.plugins.ftptelnet.TelnetProcess.java

public void receivedNegotiation(int aNegotiationCode, int aOptionCode) {
    String command = null;/*w w  w  .j ava2s .c  o m*/
    if (aNegotiationCode == TelnetNotificationHandler.RECEIVED_DO) {
        command = "DO";
    } else if (aNegotiationCode == TelnetNotificationHandler.RECEIVED_DONT) {
        command = "DONT";
    } else if (aNegotiationCode == TelnetNotificationHandler.RECEIVED_WILL) {
        command = "WILL";
    } else if (aNegotiationCode == TelnetNotificationHandler.RECEIVED_WONT) {
        command = "WONT";
    }
    LOGGER.info("Received " + command + " for option code " + aOptionCode);
}

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;// w  w w  .  j  a va2 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.smartfrog.services.net.TelnetImpl.java

/**
 * Callback method called when TelnetClient receives an option negotiation
 * command./*from   w w w.j a  v a 2 s . c  om*/
 * <p/>
 *
 * @param negotiation_code - type of negotiation command received
 *                         (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL,
 *                         RECEIVED_WONT)
 *                         <p/>
 * @param option_code      - code of the option negotiated
 *                         <p/>
 *                         *
 */
@Override
public void receivedNegotiation(int negotiation_code, int option_code) {
    String command = null;
    if (negotiation_code == TelnetNotificationHandler.RECEIVED_DO) {
        command = "DO";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_DONT) {
        command = "DONT";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WILL) {
        command = "WILL";
    } else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WONT) {
        command = "WONT";
    }
    sfLog().debug("Received negotiation code " + command);
}