Skip to content

Commit 8d68def

Browse files
committed
Changing protocol from https to http in
WalledGardenInternetObservingStrategy, it stopped working correctly for default host and changing port didn't help - fixes #422 and #412
1 parent 06753fe commit 8d68def

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
apply plugin: 'io.codearte.nexus-staging'
44

55
ext {
6-
minSdkVersion = 9
6+
minSdkVersion = 14
77
minSdkVersionApps = 23
88
compileSdkVersion = 28
99
buildToolsVersion = '28.0.3'
1010
gradleVersion = '4.6'
11-
kotlinVersion = '1.3.70'
11+
kotlinVersion = '1.3.71'
1212
detektVersion = '1.0.0.RC6-1'
1313
}
1414

gradle.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ org.gradle.jvmargs=-XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+Heap
1818

1919
android.useAndroidX=true
2020
android.enableJetifier=true
21-
android.enableR8.fullMode=false
21+
android.enableR8.fullMode=false
22+
android.enableUnitTestBinaryResources=true

library/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ android {
4747
}
4848
}
4949

50+
testOptions.unitTests.includeAndroidResources = true
51+
5052
jacocoAndroidUnitTestReport {
5153
csv.enabled false
5254
html.enabled true

library/src/main/java/com/github/pwittchen/reactivenetwork/library/rx2/internet/observing/InternetObservingSettings.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public InternetObservingStrategy strategy() {
131131
public final static class Builder {
132132
private int initialInterval = 0;
133133
private int interval = 2000;
134-
private String host = "https://clients3.google.com/generate_204";
134+
private String host = "http://clients3.google.com/generate_204";
135135
private int port = 80;
136136
private int timeout = 2000;
137137
private int httpResponse = HttpURLConnection.HTTP_NO_CONTENT;

library/src/main/java/com/github/pwittchen/reactivenetwork/library/rx2/internet/observing/strategy/WalledGardenInternetObservingStrategy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* if a device is connected to the Internet or not.
4141
*/
4242
@Open public class WalledGardenInternetObservingStrategy implements InternetObservingStrategy {
43-
private static final String DEFAULT_HOST = "https://clients3.google.com/generate_204";
43+
private static final String DEFAULT_HOST = "http://clients3.google.com/generate_204";
4444
private static final String HTTP_PROTOCOL = "http://";
4545
private static final String HTTPS_PROTOCOL = "https://";
4646

library/src/test/java/com/github/pwittchen/reactivenetwork/library/rx2/internet/observing/InternetObservingSettingsTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void shouldBuildSettingsWithDefaultValues() {
4646
// then
4747
assertThat(settings.initialInterval()).isEqualTo(0);
4848
assertThat(settings.interval()).isEqualTo(2000);
49-
assertThat(settings.host()).isEqualTo("https://clients3.google.com/generate_204");
49+
assertThat(settings.host()).isEqualTo("http://clients3.google.com/generate_204");
5050
assertThat(settings.port()).isEqualTo(80);
5151
assertThat(settings.timeout()).isEqualTo(2000);
5252
assertThat(settings.httpResponse()).isEqualTo(204);

library/src/test/java/com/github/pwittchen/reactivenetwork/library/rx2/internet/observing/strategy/WalledGardenInternetObservingStrategyTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private String getHost() {
160160

161161
// when
162162
HttpURLConnection connection =
163-
strategy.createHttpsUrlConnection(getHost(), PORT, TIMEOUT_IN_MS);
163+
strategy.createHttpsUrlConnection("https://clients3.google.com", PORT, TIMEOUT_IN_MS);
164164

165165
// then
166166
assertThat(connection).isNotNull();
@@ -176,7 +176,7 @@ private String getHost() {
176176
// given
177177
final String errorMsg = "Could not establish connection with WalledGardenStrategy";
178178
final IOException givenException = new IOException(errorMsg);
179-
when(strategy.createHttpsUrlConnection(getHost(), PORT, TIMEOUT_IN_MS)).thenThrow(
179+
when(strategy.createHttpUrlConnection(getHost(), PORT, TIMEOUT_IN_MS)).thenThrow(
180180
givenException);
181181

182182
// when

0 commit comments

Comments
 (0)