コード例 #1
0
  private final void disconnectTheOtherGuy(PyroClient client) {
    PyroClient otherGuy = (PyroClient) client.attachment();

    // also disconnect the other guy
    if (otherGuy != null && !otherGuy.isDisconnected()) {
      client.attach(null);
      otherGuy.shutdown();
    }

    // note that you don't know whether you are the
    // other guy, or the other guy is! if either end
    // disconnects, the _other_ guy disconnects too.
  }