code: public void checkWaitingConnection() throws SQLException {
      if (isSecondaryHostFail()) {
        proxy.lock.lock();
        try {
          Protocol waitingProtocol = waitNewSecondaryProtocol.getAndSet(null);
          if (waitingProtocol != null && pingSecondaryProtocol(waitingProtocol)) {
            lockAndSwitchSecondary(waitingProtocol);
          }
        } finally {
          proxy.lock.unlock();
        }
      }
  
      if (isMasterHostFail()) {
        proxy.lock.lock();
        try {
          Protocol waitingProtocol = waitNewMasterProtocol.getAndSet(null);
          if (waitingProtocol != null && pingMasterProtocol(waitingProtocol)) {
            lockAndSwitchMaster(waitingProtocol);
          }
        } finally {
          proxy.lock.unlock();
        }
      }
    }
docs: Verify that there is waiting connection that have to replace failing one. If there is replace
  failed connection with new one.
  
  @throws SQLException if error occur