Example usage for org.apache.commons.net.telnet TelnetClient sendAYT

List of usage examples for org.apache.commons.net.telnet TelnetClient sendAYT

Introduction

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

Prototype

public boolean sendAYT(long timeout) throws IOException, IllegalArgumentException, InterruptedException 

Source Link

Document

Sends an Are You There sequence and waits for the result.

Usage

From source file:org.mule.transport.telnet.TelnetMessageDispatcher.java

@Override
public RetryContext validateConnection(RetryContext retryContext) {

    try {/*from   w  w w.  ja  v  a 2 s.c  om*/
        String host = getConnector().getHost();
        int port = getConnector().getPort();
        TelnetClient client = new TelnetClient();
        client.connect(host, port);
        boolean b = client.sendAYT(2000);

        if (b) {
            retryContext.setOk();
        } else {
            retryContext.setFailed(new IOException("sendAYT is false."));
        }
    } catch (Exception e) {
        retryContext.setFailed(e);
    }
    return retryContext;
}