{"action":"created","issue":{"url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/84","repository_url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client","labels_url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/84/comments","events_url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/84/events","html_url":"https://github.com/TakahikoKawasaki/nv-websocket-client/issues/84","id":183336799,"number":84,"title":"Getting WebSocketException on Android API below 20 but not higher","user":{"login":"jerrymg","id":22700130,"avatar_url":"https://avatars.githubusercontent.com/u/22700130?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrymg","html_url":"https://github.com/jerrymg","followers_url":"https://api.github.com/users/jerrymg/followers","following_url":"https://api.github.com/users/jerrymg/following{/other_user}","gists_url":"https://api.github.com/users/jerrymg/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrymg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrymg/subscriptions","organizations_url":"https://api.github.com/users/jerrymg/orgs","repos_url":"https://api.github.com/users/jerrymg/repos","events_url":"https://api.github.com/users/jerrymg/events{/privacy}","received_events_url":"https://api.github.com/users/jerrymg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-17T06:40:48Z","updated_at":"2016-10-18T05:36:23Z","closed_at":null,"body":"I get the following exception only on  API below 20 but not higher.\r\n\r\nHere is the code\r\n```\r\nconnection = new WebSocketFactory()\r\n                        .createSocket(wssURLString)\r\n                        .addListener(new WebSocketAdapter() {\r\n...\r\nconnection.connect();\r\n```\r\nHere is the exception\r\n\r\n```\r\nW/System.err: com.neovisionaries.ws.client.WebSocketException: Failed to get the input stream of the raw socket: Connection closed by peer\r\nW/System.err:     at com.neovisionaries.ws.client.WebSocket.openInputStream(WebSocket.java:3013)\r\nW/System.err:     at com.neovisionaries.ws.client.WebSocket.shakeHands(WebSocket.java:2971)\r\nW/System.err:     at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2025)\r\n...\r\nW/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:288)\r\nW/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)\r\nW/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)\r\nW/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)\r\nW/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)\r\nW/System.err:     at java.lang.Thread.run(Thread.java:841)\r\nW/System.err: Caused by: javax.net.ssl.SSLException: Connection closed by peer\r\nW/System.err:     at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)\r\nW/System.err:     at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405)\r\nW/System.err:     at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.<init>(OpenSSLSocketImpl.java:661)\r\nW/System.err:     at com.android.org.conscrypt.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:632)\r\nW/System.err:     at com.neovisionaries.ws.client.WebSocket.openInputStream(WebSocket.java:3006)\r\nW/System.err: \t... 10 more\r\n```"},"comment":{"url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/comments/254411516","html_url":"https://github.com/TakahikoKawasaki/nv-websocket-client/issues/84#issuecomment-254411516","issue_url":"https://api.github.com/repos/TakahikoKawasaki/nv-websocket-client/issues/84","id":254411516,"user":{"login":"jerrymg","id":22700130,"avatar_url":"https://avatars.githubusercontent.com/u/22700130?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrymg","html_url":"https://github.com/jerrymg","followers_url":"https://api.github.com/users/jerrymg/followers","following_url":"https://api.github.com/users/jerrymg/following{/other_user}","gists_url":"https://api.github.com/users/jerrymg/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrymg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrymg/subscriptions","organizations_url":"https://api.github.com/users/jerrymg/orgs","repos_url":"https://api.github.com/users/jerrymg/repos","events_url":"https://api.github.com/users/jerrymg/events{/privacy}","received_events_url":"https://api.github.com/users/jerrymg/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T05:36:23Z","updated_at":"2016-10-18T05:36:23Z","body":"I think your right, it is a TLS version issue, but when I tried to force TLSv1.2 with `NaiveSSLContext.getInstance` below or disabled SSL3 with `NoSSLv3SocketFactory` below I still get the same `WebSocketException` exception mentioned above. Do you know what I’m doing wrong?\r\n\r\n\r\nI tried your class `NaiveSSLContext` with\r\n```\r\nWebSocketFactory factory = new WebSocketFactory();\r\nfactory.setSSLContext(NaiveSSLContext.getInstance(\"TLSv1.2\"));\r\nconnection = factory\r\n                        .createSocket(“wss://www.arcbit.net:443/inv”)\r\n                        .addListener(new WebSocketAdapter() {\r\n...\r\nconnection.connect();\r\n```\r\n\r\n\r\nAnd I also tried \r\n```\r\nWebSocketFactory factory = new WebSocketFactory();\r\nfactory.setSSLSocketFactory(new NoSSLv3SocketFactory());\r\nconnection = factory\r\n                        .createSocket(“wss://www.arcbit.net:443/inv”)\r\n                        .addListener(new WebSocketAdapter() {\r\n\r\n```\r\nWhere `NoSSLv3SocketFactory` came from https://github.com/Rap-ID/Rap-ID-Android/blob/master/app/src/main/java/com/hackerchai/rapid/Thread/NoSSLv3SocketFactory.java\r\n"}}
{"actor":{"display_login":"jerrymg"}}