Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
DefaultInternetObservingStrategy Does not Correctly Observe "Internet Walled Garden" State When it Should #116
DefaultInternetObservingStrategy currently doesn't account for the case that:
Steps to Reproduce
The observable should emit "False" since there is no internet available until you "sign into" the network
The observable is returning true.
Apparently POSIX's ping (ping fails) works as expected and I was expecting the same behavior with the Socket class in Java, but that's not the case at all.
I looked into the issue via SO and found this which works: http://stackoverflow.com/questions/10813635/checking-internet-connection-on-wifi-hotspot
Good news is that you designed the ReactiveNetwork API pretty well so I simply had to just create my own class that implemented the InternetStrategy interface, skim through your source code, and wrapped the solution above in the class:
This internet strategy not only listens to internet status but also to the walled garden case. The only problem with this code right now is it won't work in China because of their amazing "Great Firewall" which makes the google endpoint I'm creating requests for return a 302 instead of a 204.
Thank you for reporting this issue with such detailed description. Internet Walled Garden is an interesting use case and I haven't taken it into consideration.
PR with improvements is welcome of course.
You can also add a few unit tests as you mentioned. ReactiveNetwork now uses Robolectric for unit testing, so creating new tests would be more convenient than before. You can also find exemplary unit tests in this repository.
Probably we also need to rename SocketErrorHandler and its method to something more general because your new strategy is not using a socket, but it could have error handling functionality. I've added separate issue for that in #118.