Exemplo n.º 1
0
 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);
   }
 }
Exemplo n.º 2
0
  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
        }
      }
    }
  }
Exemplo n.º 3
0
 public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
   engine.error(cause);
 }