Skip to content

Commit dbfd4df

Browse files
committed
Merge pull request #86 from aoberoi/dkharrat-upgrade_asynchttpclient
Dkharrat upgrade asynchttpclient
2 parents b715306 + 51694c4 commit dbfd4df

23 files changed

+42
-67
lines changed

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
language: java
22
jdk:
33
- openjdk7
4-
- openjdk6
54
- oraclejdk7
65
- oraclejdk8
6+
77
notifications:
88
slack:
99
secure: fGRoClN1IQiZvokEiqmKOrF7EeaNQDHDHqUMaT4n7d3qW2fMe3N8ZLxlIDlzgJ2pv09VWqK7rmPgdhJR8yVG7OE4QQ5kzR59xD8ePN0j0jf6W6eOBPq3a9UUarnny21LFsShvRMZ/BaXcvTox1zMVltpMGFw2K4ijH8+ZvdkNz8=
10+
1011
before_script:
1112
- echo $JAVA_OPTS
1213
- export JAVA_OPTS="$JAVA_OPTS -Xmx1024m"
1314
- export GRADLE_OPTS=-Xmx1024m
15+
16+
# workaround for https://github.com/travis-ci/travis-ci/issues/5227
17+
before_install:
18+
- cat /etc/hosts # optionally check the content *before*
19+
- sudo hostname "$(hostname | cut -c1-63)"
20+
- sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
21+
- cat /etc/hosts # optionally check the content *after*

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dependencies {
4242
testCompile group: 'junit', name: 'junit', version: '[4.3,5.0['
4343
testCompile group: 'com.github.tomakehurst', name: 'wiremock', version: '[1.45,1.99999)'
4444
testCompile group: 'commons-lang', name: 'commons-lang', version: '[2.6,2.99999)'
45-
compile group: 'com.ning', name: 'async-http-client', version: '[1.6.1,1.9['
45+
compile group: 'com.ning', name: 'async-http-client', version: '[1.9,2.0['
4646
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '[2.3.1,2.99999)'
4747
compile group: 'commons-validator', name: 'commons-validator', version: '[1.4.0,1.99999)'
4848
compile group: 'commons-codec', name: 'commons-codec', version: '[1.9,1.99999]'

src/main/java/com/opentok/Archive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/ArchiveList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/ArchiveMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/ArchiveProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/MediaMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/OpenTok.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/Role.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/Session.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/SessionProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/TokenOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/constants/Version.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/constants/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/exception/InvalidArgumentException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/exception/OpenTokException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/exception/RequestException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/exception/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/util/Crypto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/util/HttpClient.java

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.
@@ -38,18 +38,13 @@ private HttpClient(Builder builder) {
3838
}
3939

4040
public String createSession(Map<String, Collection<String>> params) throws RequestException {
41-
Future<Response> request = null;
4241
String responseString = null;
4342
Response response = null;
4443
FluentStringsMap paramsString = new FluentStringsMap().addAll(params);
4544

46-
try {
47-
request = this.preparePost(this.apiUrl + "/session/create")
48-
.setParameters(paramsString)
49-
.execute();
50-
} catch (IOException e) {
51-
throw new RequestException("Could not create an OpenTok Session", e);
52-
}
45+
Future<Response> request = this.preparePost(this.apiUrl + "/session/create")
46+
.setFormParams(paramsString)
47+
.execute();
5348

5449
try {
5550
response = request.get();
@@ -75,14 +70,8 @@ public String createSession(Map<String, Collection<String>> params) throws Reque
7570

7671
public String getArchive(String archiveId) throws RequestException {
7772
String responseString = null;
78-
Future<Response> request = null;
7973
String url = this.apiUrl + "/v2/partner/" + this.apiKey + "/archive/" + archiveId;
80-
81-
try {
82-
request = this.prepareGet(url).execute();
83-
} catch (IOException e) {
84-
throw new RequestException("Could not get an OpenTok Archive", e);
85-
}
74+
Future<Response> request = this.prepareGet(url).execute();
8675

8776
try {
8877
Response response = request.get();
@@ -116,7 +105,6 @@ public String getArchive(String archiveId) throws RequestException {
116105

117106
public String getArchives(int offset, int count) throws RequestException {
118107
String responseString = null;
119-
Future<Response> request = null;
120108
// TODO: maybe use a StringBuilder?
121109
String url = this.apiUrl + "/v2/partner/" + this.apiKey + "/archive";
122110
if (offset != 0 || count != 1000) {
@@ -129,11 +117,7 @@ public String getArchives(int offset, int count) throws RequestException {
129117
}
130118
}
131119

132-
try {
133-
request = this.prepareGet(url).execute();
134-
} catch (IOException e) {
135-
throw new RequestException("Could not get OpenTok Archives", e);
136-
}
120+
Future<Response> request = this.prepareGet(url).execute();
137121

138122
try {
139123
Response response = request.get();
@@ -165,7 +149,6 @@ public String getArchives(int offset, int count) throws RequestException {
165149
public String startArchive(String sessionId, ArchiveProperties properties)
166150
throws OpenTokException {
167151
String responseString = null;
168-
Future<Response> request = null;
169152
String requestBody = null;
170153
// TODO: maybe use a StringBuilder?
171154
String url = this.apiUrl + "/v2/partner/" + this.apiKey + "/archive";
@@ -185,14 +168,10 @@ public String startArchive(String sessionId, ArchiveProperties properties)
185168
} catch (JsonProcessingException e) {
186169
throw new OpenTokException("Could not start an OpenTok Archive. The JSON body encoding failed.", e);
187170
}
188-
try {
189-
request = this.preparePost(url)
190-
.setBody(requestBody)
191-
.setHeader("Content-Type", "application/json")
192-
.execute();
193-
} catch (IOException e) {
194-
throw new RequestException("Could not start an OpenTok Archive.", e);
195-
}
171+
Future<Response> request = this.preparePost(url)
172+
.setBody(requestBody)
173+
.setHeader("Content-Type", "application/json")
174+
.execute();
196175

197176
try {
198177
Response response = request.get();
@@ -228,15 +207,9 @@ public String startArchive(String sessionId, ArchiveProperties properties)
228207

229208
public String stopArchive(String archiveId) throws RequestException {
230209
String responseString = null;
231-
Future<Response> request = null;
232210
// TODO: maybe use a StringBuilder?
233211
String url = this.apiUrl + "/v2/partner/" + this.apiKey + "/archive/" + archiveId + "/stop";
234-
235-
try {
236-
request = this.preparePost(url).execute();
237-
} catch (IOException e) {
238-
throw new RequestException("Could not stop an OpenTok Archive. archiveId = " + archiveId, e);
239-
}
212+
Future<Response> request = this.preparePost(url).execute();
240213

241214
try {
242215
Response response = request.get();
@@ -276,14 +249,8 @@ public String stopArchive(String archiveId) throws RequestException {
276249

277250
public String deleteArchive(String archiveId) throws RequestException {
278251
String responseString = null;
279-
Future<Response> request = null;
280252
String url = this.apiUrl + "/v2/partner/" + this.apiKey + "/archive/" + archiveId;
281-
282-
try {
283-
request = this.prepareDelete(url).execute();
284-
} catch (IOException e) {
285-
throw new RequestException("Could not delete an OpenTok Archive. archiveId = " + archiveId, e);
286-
}
253+
Future<Response> request = this.prepareDelete(url).execute();
287254

288255
try {
289256
Response response = request.get();

src/test/java/com/opentok/test/Helpers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/test/java/com/opentok/test/OpenTokTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2015 TokBox, Inc.
3+
* Copyright (C) 2016 TokBox, Inc.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

0 commit comments

Comments
 (0)