예제 #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);
   }
 }
예제 #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
        }
      }
    }
  }
예제 #3
0
 public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
   engine.error(cause);
 }