Ejemplo n.º 1
0
  @Override
  public void receivedData(PyroClient client, ByteBuffer data) {
    client.selector().checkThread();

    // send what you received to the other guy
    PyroClient otherGuy = (PyroClient) client.attachment();

    System.out.println(
        "traffic:" + client + " => " + otherGuy + " (" + data.remaining() + " bytes)");

    try {
      otherGuy.writeCopy(data);
    } catch (IllegalStateException exc) {
      // boo
    }
  }