/**
   * Get a CouchbaseClient based on the REST response from a Couchbase server where the username is
   * different than the bucket name.
   *
   * <p>Note that when specifying a ConnectionFactory you must specify a BinaryConnectionFactory.
   * Also the ConnectionFactory's protocol and locator values are always overwritten. The protocol
   * will always be binary and the locator will be chosen based on the bucket type you are
   * connecting to.
   *
   * <p>To connect to the "default" special bucket for a given cluster, use an empty string as the
   * password.
   *
   * <p>If a password has not been assigned to the bucket, it is typically an empty string.
   *
   * <p>The subscribe variable is determines whether or not we will subscribe to the configuration
   * changes feed. This constructor should be used when calling super from subclasses of
   * CouchbaseClient since the subclass might want to start the changes feed later.
   *
   * @param cf the ConnectionFactory to use to create connections
   * @throws IOException if connections could not be made
   * @throws ConfigurationException if the configuration provided by the server has issues or is not
   *     compatible
   */
  public CouchbaseClient(CouchbaseConnectionFactory cf) throws IOException {
    super(cf, AddrUtil.getAddresses(cf.getVBucketConfig().getServers()));
    List<InetSocketAddress> addrs =
        AddrUtil.getAddressesFromURL(cf.getVBucketConfig().getCouchServers());

    getLogger().info(MODE_ERROR);
    vconn = cf.createViewConnection(addrs);
    cf.getConfigurationProvider().subscribe(cf.getBucketName(), this);
  }
 @Override
 public boolean shutdown(long timeout, TimeUnit unit) {
   boolean shutdownResult = false;
   try {
     shutdownResult = super.shutdown(timeout, unit);
     CouchbaseConnectionFactory cf = (CouchbaseConnectionFactory) connFactory;
     cf.getConfigurationProvider().shutdown();
     vconn.shutdown();
   } catch (IOException ex) {
     Logger.getLogger(CouchbaseClient.class.getName())
         .log(Level.SEVERE, "Unexpected IOException in shutdown", ex);
     throw new RuntimeException(null, ex);
   }
   return shutdownResult;
 }