Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/src/main/java/io/minio/MinioClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.Protocol;

import org.joda.time.DateTime;
import org.xmlpull.v1.XmlPullParser;
Expand Down Expand Up @@ -655,11 +656,14 @@ public MinioClient(String endpoint, int port, String accessKey, String secretKey
if (httpClient != null) {
this.httpClient = httpClient;
} else {
List<Protocol> protocol = new LinkedList<>();
protocol.add(Protocol.HTTP_1_1);
this.httpClient = new OkHttpClient();
this.httpClient = this.httpClient.newBuilder()
.connectTimeout(DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
.writeTimeout(DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
.readTimeout(DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS)
.protocols(protocol)
.build();
}

Expand Down
5 changes: 1 addition & 4 deletions functional/FunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1196,14 +1196,11 @@ public static void getObject_test7() throws Exception {
}

InputStream stream = client.getObject(bucketName, objectName, sse);
byte[] getbyteArray = new byte[stream.available()];
byte[] getbyteArray = new byte[stream.available()];
int bytes_read_get = stream.read(getbyteArray);
String getString = new String(getbyteArray, StandardCharsets.UTF_8);
stream.close();

// client.getObject(bucketName, objectName, sse)
// .close();

// Compare if contents received are same as the initial uploaded object.
if ((!putString.equals(getString)) || (bytes_read_put != bytes_read_get)) {
throw new Exception("Contents received from getObject doesn't match initial contents.");
Expand Down