Esempio n. 1
0
  public ConnectionInfo getOrWaitForConnectionInfo(int minKexCount) throws IOException {
    synchronized (accessLock) {
      while (true) {
        if ((lastConnInfo != null) && (lastConnInfo.keyExchangeCounter >= minKexCount))
          return lastConnInfo;

        if (connectionClosed)
          throw (IOException)
              new IOException("Key exchange was not finished, connection is closed.")
                  .initCause(tm.getReasonClosedCause());

        try {
          accessLock.wait();
        } catch (InterruptedException e) {
        }
      }
    }
  }