Socket connect took longer than specified timeout

Sure thing! This happens at the point where you initialize a connection to the Couchbase cluster:

CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
    //this set the IO socket timeout globally, to 45s
    .socketConnectTimeout((int) TimeUnit.SECONDS.toMillis(45))
    //this sets the connection timeout for openBucket calls globally (unless a particular call provides its own timeout)
    .connectTimeout(TimeUnit.SECONDS.toMillis(60))
    .build();

//once you've prepared an environment configuration, use it when connecting to the cluster
Cluster cluster = CouchbaseCluster.create(env, "127.0.0.1"); //adapt your IP/hostname

//then you open the bucket. this operation will use the 60s timeout you configured above
//and the 45s network IO timeout internally
Bucket bucket = cluster.openBucket("myBucket");

Note that these values do not necessarily make sense, to be tuned according to your environment.
Most notably, if you’ve noticed that the DNS name resolution takes 4.5 seconds per node, then your connectTimeout should at least be greater than numberOfNodes x 4.5 x 1000 milliseconds