code: void waitForTransparentConnect() throws InterruptedException,
        NotConnectedToServerException {
      if (state == DISCONNECTED_VISIBLE) {
        LOG.warn(listeningPort + ": waitForTransparentConnect: got visible" +
            " disconnected state");
        throw new NotConnectedToServerException();
      }
      
      // Wait until we are not hidden disconnected
      while (state != CONNECTED) {
        connectionLock.wait();
        switch (state) {
          case CONNECTED:
            break;
          case DISCONNECTED_HIDDEN:
            continue;
          case DISCONNECTED_VISIBLE:
            LOG.warn(listeningPort + ": waitForTransparentConnect: got visible" +
                " disconnected state");
            throw new NotConnectedToServerException();
        }
      }
    }
docs: Must be called holding the connection lock returned by getConnectionLock.
  It waits until the current connection state is CONNECTED. If it ever
  gets to DISCONNECTED_VISIBLE it will raise an exception. If the current
  state is CONNECTED, then it will return without waiting.
  
  @throws InterruptedException
  @throws NotConnectedToServerException when we got into a
  DISCONNECTED_VISIBLE state.