{"action":"created","issue":{"url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/209","labels_url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/209/comments","events_url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/209/events","html_url":"https://github.com/NanoHttpd/nanohttpd/issues/209","id":95374837,"number":209,"title":"ssl connection fail  for safari and android browser","user":{"login":"stereo720712","id":695427,"avatar_url":"https://avatars.githubusercontent.com/u/695427?v=3","gravatar_id":"","url":"https://api.github.com/users/stereo720712","html_url":"https://github.com/stereo720712","followers_url":"https://api.github.com/users/stereo720712/followers","following_url":"https://api.github.com/users/stereo720712/following{/other_user}","gists_url":"https://api.github.com/users/stereo720712/gists{/gist_id}","starred_url":"https://api.github.com/users/stereo720712/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stereo720712/subscriptions","organizations_url":"https://api.github.com/users/stereo720712/orgs","repos_url":"https://api.github.com/users/stereo720712/repos","events_url":"https://api.github.com/users/stereo720712/events{/privacy}","received_events_url":"https://api.github.com/users/stereo720712/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-16T07:57:27Z","updated_at":"2015-07-17T06:45:47Z","closed_at":null,"body":"try establish a https server in android for other phones to connect,but only iphone6 sometimes can connected , ipod ,android browser all failed to get the webserver content. (the browser message is fail to establish safe connect) I use nanohttpd's simpleServer Class to establish it.\r\n\r\nmy CA is here\r\n\r\nhttp://www.mediafire.com/download/53f6e9uveb47kqv/ca.cer // for client to download\r\n\r\nhttp://www.mediafire.com/download/v9i58n38yb85co5/server.p12 //for server to load keystore\r\n\r\nCA password both are singuler\r\n\r\nHere is my sslServerSocket Code\r\n\r\n    char[]kspass = KEYSTOREPASS.toCharArray();\r\n    char[]ctpass = KEYSTOREPASS.toCharArray();\r\n    try {\r\n\r\n\r\n        KeyStore ks = KeyStore.getInstance(\"PKCS12\");\r\n        //ks.load(new FileInputStream(\"file:///android_asset/singuler.keystore\"),kspass);\r\n        ks.load(getResources().getAssets().open(\"server.p12\"),kspass);\r\n\r\n        KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());\r\n        kmf.init(ks, ctpass);\r\n        TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(\"X509\");\r\n        SSLContext sc = SSLContext.getInstance(\"TLS\");\r\n        sc.init(kmf.getKeyManagers(), null, null);\r\n\r\n        //webServer.makeSecure(NanoHTTPD.makeSSLSocketFactory(ks, kmf.getKeyManagers()));\r\n        webServerSSL.makeSecure(sc.getServerSocketFactory());\r\n\r\n    } catch (Exception e) {\r\n        // TODO: handle exceptionser\r\n        Log.i(\"test\", e.toString());\r\n    }\r\n\r\n\r\n\r\n    try {\r\n        webServer.start(15);\r\n        webServerSSL.start(15);\r\n    } catch (IOException e) {\r\n        // TODO Auto-generated catch block\r\n        e.printStackTrace();\r\n        webServer = null;\r\n        webServerSSL=null;\r\n        Log.i(\"test\", e.toString());\r\n"},"comment":{"url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/comments/122196802","html_url":"https://github.com/NanoHttpd/nanohttpd/issues/209#issuecomment-122196802","issue_url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/209","id":122196802,"user":{"login":"stereo720712","id":695427,"avatar_url":"https://avatars.githubusercontent.com/u/695427?v=3","gravatar_id":"","url":"https://api.github.com/users/stereo720712","html_url":"https://github.com/stereo720712","followers_url":"https://api.github.com/users/stereo720712/followers","following_url":"https://api.github.com/users/stereo720712/following{/other_user}","gists_url":"https://api.github.com/users/stereo720712/gists{/gist_id}","starred_url":"https://api.github.com/users/stereo720712/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stereo720712/subscriptions","organizations_url":"https://api.github.com/users/stereo720712/orgs","repos_url":"https://api.github.com/users/stereo720712/repos","events_url":"https://api.github.com/users/stereo720712/events{/privacy}","received_events_url":"https://api.github.com/users/stereo720712/received_events","type":"User","site_admin":false},"created_at":"2015-07-17T06:45:47Z","updated_at":"2015-07-17T06:45:47Z","body":"I found the answer , because of the https timeout need to set up,and I got wrong unit for timeout variable.\r\n\ttry {\r\n\t\t\twebServer.start(6000);\r\n\t\t\twebServerSSL.start(10000);\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t\twebServer = null;\r\n\t\t\twebServerSSL=null;\r\n\t\t\tLog.i(\"test\", e.toString());\r\n\t\t}\r\n\t\t\r\nit can work now , thanks.\r\n"}}