TakahikoKawasaki / nv-websocket-client

High-quality WebSocket client implementation in Java.
Apache License 2.0
2.03k stars 292 forks source link

Added Android-compatibile support for SNI in direct connections #109

Open ondrap opened 7 years ago

ondrap commented 7 years ago

This PR is not meant for direct merging, but rather for a discussion; the problem is that the API for SNI is available in Java8/Android API24 (the 'correct' implementation is in my branch https://github.com/ondrap/nv-websocket-client/tree/android-api24 ). This PR is rather slight refactoring that results in correct behaviour for direct connections on Android systems and possibly plain Java (tested with Java8). SNI in this case doesn't work for proxied connections as there is no API available to do that.

There is a slight drawback though, as there is no way to set connectionTimeout with the createSocket() call, so the system default is used. I'm OK with that for my use, however I am not sure if such a change is appropriate for the library.