public void messageReceived(IoSession session, Object message) throws Exception {
    engine.print(message);

    synchronized (engine) {
      engine.notify();
    }
  }
 protected Stack getStack(Engine engine) {
   Object o = engine.getContext().get("vfs.dirstack");
   if (o == null) {
     o = new Stack();
     engine.getContext().set("vfs.dirstack", o);
   }
   return (Stack) o;
 }
  public void sendRequest(String request) {
    if (session == null) {
      engine.error("not connected");
    } else {
      session.write(request);

      synchronized (engine) {
        try {
          engine.wait(30000);
        } catch (InterruptedException e) {
          // ignore
        }
      }
    }
  }
 public void connect() {
   ConnectFuture connectFuture = connector.connect(new InetSocketAddress(host, port), this);
   connectFuture.join(5000);
   try {
     session = connectFuture.getSession();
   } catch (RuntimeIOException e) {
     engine.error(e);
   }
 }
 public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
   engine.error(cause);
 }
 protected void printCwd(Engine engine) {
   engine.println("Current folder is " + engine.toString(engine.getCwd()));
 }