My code is like this:
public static void main(String[] args) throws Exception {
List<Transcoder<? extends Document,?>> transcoders = new ArrayList<Transcoder<? extends Document, ?>>();
transcoders.add(new RawTranscoder());
CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.connectTimeout(60000)
.kvTimeout(30000)
.build();
Cluster cluster = CouchbaseCluster.create(env,newHost);
Bucket bucket = cluster.openBucket(bucketName,"",transcoders);
testNewCouchbase(bucket);
}
public static void testNewCouchbase(final Bucket bucket) throws Exception {
String key = "1022081080102468052";
BinaryDocument res = bucket.get(BinaryDocument.create(key));
byte[] data = new byte[res.content().capacity()];
for (int i = 0; i < res.content().capacity(); ++i) {
data[i] = res.content().getByte(i);
}
System.out.println(data.length);
}
No matter how i change the kvtimeout and connectiontimeout, the following exception always happens:
Please help. Thanks