Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong port in connectivity check calls in 3.0.7 #422

Closed
andrey-bolduzev opened this issue Mar 30, 2020 · 2 comments · Fixed by #425
Closed

Wrong port in connectivity check calls in 3.0.7 #422

andrey-bolduzev opened this issue Mar 30, 2020 · 2 comments · Fixed by #425
Labels

Comments

@andrey-bolduzev
Copy link

Describe the bug
After upgrading to 3.0.7 ReactiveNetwork.observeInternetConnectivity stops working with:

E/ReactiveNetwork( 3672): Could not establish connection with WalledGardenStrategy
E/ReactiveNetwork( 3672): java.net.ConnectException: failed to connect to clients3.google.com/2607:f8b0:400b:809::200e (port 80) after 2000ms: isConnected failed: ENETUNREACH (Network is unreachable)
E/ReactiveNetwork( 3672): 	at libcore.io.IoBridge.isConnected(IoBridge.java:238)
E/ReactiveNetwork( 3672): 	at libcore.io.IoBridge.connectErrno(IoBridge.java:171)
E/ReactiveNetwork( 3672): 	at libcore.io.IoBridge.connect(IoBridge.java:122)
E/ReactiveNetwork( 3672): 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
E/ReactiveNetwork( 3672): 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:456)
E/ReactiveNetwork( 3672): 	at java.net.Socket.connect(Socket.java:882)
E/ReactiveNetwork( 3672): 	at com.android.okhttp.internal.Platform.connectSocket(Platform.java:174)
E/ReactiveNetwork( 3672): 	at com.android.okhttp.Connection.connect(Connection.java:152)
E/ReactiveNetwork( 3672): 	at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:276)
E/ReactiveNetwork( 3672): 	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
E/ReactiveNetwork( 3672): 	at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:382)
E/ReactiveNetwork( 3672): 	at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
E/ReactiveNetwork( 3672): 	at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
E/ReactiveNetwork( 3672): 	at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
E/ReactiveNetwork( 3672): 	at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
E/ReactiveNetwork( 3672): 	at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy.isConnected(WalledGardenInternetObservingStrategy.java:109)
E/ReactiveNetwork( 3672): 	at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy$1.apply(WalledGardenInternetObservingStrategy.java:66)
E/ReactiveNetwork( 3672): 	at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy$1.apply(WalledGardenInternetObservingStrategy.java:64)
E/ReactiveNetwork( 3672): 	at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:57)
E/ReactiveNetwork( 3672): 	at io.reactivex.internal.operators.observable.ObservableInterval$IntervalObserver.run(ObservableInterval.java:82)
E/ReactiveNetwork( 3672): 	at io.reactivex.Scheduler$PeriodicDirectTask.run(Scheduler.java:532)
E/ReactiveNetwork( 3672): 	at io.reactivex.Scheduler$Worker$PeriodicTask.run(Scheduler.java:479)
E/ReactiveNetwork( 3672): 	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
E/ReactiveNetwork( 3672): 	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
E/ReactiveNetwork( 3672): 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/ReactiveNetwork( 3672): 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
E/ReactiveNetwork( 3672): 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
E/ReactiveNetwork( 3672): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/ReactiveNetwork( 3672): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/ReactiveNetwork( 3672): 	at java.lang.Thread.run(Thread.java:818)
E/ReactiveNetwork( 3672): Caused by: android.system.ErrnoException: isConnected failed: ENETUNREACH (Network is unreachable)
E/ReactiveNetwork( 3672): 	at libcore.io.IoBridge.isConnected(IoBridge.java:223)
E/ReactiveNetwork( 3672): 	... 29 more

To Reproduce
Call ReactiveNetwork.observeInternetConnectivity.

Expected behavior
true is emitted on detected network connectivity.

Smartphone (please complete the following information):

  • Device: Pixel 2 (emulator)
  • OS: Android 10
  • Library Version: 3.0.7

Additional context
3.0.6 works as expected with the default config and allowed cleartext.

The default config with 3.0.7 tries to reach https://clients3.google.com/generate_204 on port 80.

The following version with the manual port works as expected:

ReactiveNetwork.observeInternetConnectivity(
    InternetObservingSettings.builder().host("https://clients3.google.com/generate_204").port(443).build()
)!!
@pwittchen pwittchen added the bug label Mar 30, 2020
@pwittchen
Copy link
Owner

Thanks for reporting this problem. It should be fixed soon.

pwittchen added a commit that referenced this issue Apr 1, 2020
WalledGardenInternetObservingStrategy, it stopped working correctly for default host and changing port didn't help - fixes #422 and #412
@pwittchen
Copy link
Owner

pwittchen commented Apr 1, 2020

I tested it for port 443 and it didn't work in my case. I decided to change protocol from https into http in PR #425 because it works properly with default host. We can investigate this issue in the future in case of changing protocol back to https. I think not secure connection is not a big deal here because it's used just for "ping" - not for transmitting sensitive data.

pwittchen added a commit that referenced this issue Apr 1, 2020
WalledGardenInternetObservingStrategy, it stopped working correctly for default host and changing port didn't help - fixes #422 and #415
@pwittchen pwittchen mentioned this issue Apr 1, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants