{"action":"created","issue":{"url":"https://api.github.com/repos/cloudant/java-cloudant/issues/282","repository_url":"https://api.github.com/repos/cloudant/java-cloudant","labels_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/282/labels{/name}","comments_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/282/comments","events_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/282/events","html_url":"https://github.com/cloudant/java-cloudant/issues/282","id":171860078,"number":282,"title":"IMPORTANT: Unable to connect to cloudant using Proxy","user":{"login":"neekrish","id":14052682,"avatar_url":"https://avatars.githubusercontent.com/u/14052682?v=3","gravatar_id":"","url":"https://api.github.com/users/neekrish","html_url":"https://github.com/neekrish","followers_url":"https://api.github.com/users/neekrish/followers","following_url":"https://api.github.com/users/neekrish/following{/other_user}","gists_url":"https://api.github.com/users/neekrish/gists{/gist_id}","starred_url":"https://api.github.com/users/neekrish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neekrish/subscriptions","organizations_url":"https://api.github.com/users/neekrish/orgs","repos_url":"https://api.github.com/users/neekrish/repos","events_url":"https://api.github.com/users/neekrish/events{/privacy}","received_events_url":"https://api.github.com/users/neekrish/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-08-18T09:43:10Z","updated_at":"2016-08-25T12:15:45Z","closed_at":null,"body":" When using the cloudant client to connect to cloudant.com using a proxy server, the below exception is seen. Also to add for proxy to work I had to add this code snippet too:\r\n\r\n`                       \r\n     Authenticator authenticator = new Authenticator() {\r\n\r\n\t\t\t        public PasswordAuthentication getPasswordAuthentication() {\r\n\t\t\t            return (new PasswordAuthentication(cloudantProxyUsername,\r\n\t\t\t            \t\tcloudantProxyPassword.toCharArray()));\r\n\t\t\t        }\r\n\t\t\t    };\r\n\t\t\t    Authenticator.setDefault(authenticator);\r\n`\r\n\r\n- CloudantClient (java-cloudant) version(s) that are affected by this issue. - 2.5.0\r\n- Java version (including vendor and platform). - IBM Java 8\r\n- If you're using the optional okhttp dependency. - NO\r\n- A small code sample that demonstrates the issue.\r\n\r\n\r\njava.net.ConnectException: Connection timed out\r\nat java.net.PlainSocketImpl.socketConnect(Native Method)\r\nat java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)\r\nat java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)\r\nat java.net.AbstractPlainSocketImpl.connect(Unknown Source)\r\nat java.net.SocksSocketImpl.connect(Unknown Source)\r\nat java.net.Socket.connect(Unknown Source)\r\nat com.ibm.jsse2.as.connect(Unknown Source)\r\nat sun.net.NetworkClient.doConnect(Unknown Source)\r\nat sun.net.www.http.HttpClient.openServer(Unknown Source)\r\nat sun.net.www.http.HttpClient.openServer(Unknown Source)\r\nat com.ibm.net.ssl.www2.protocol.https.c.<init>(Unknown Source)\r\nat com.ibm.net.ssl.www2.protocol.https.c.a(Unknown Source)\r\nat com.ibm.net.ssl.www2.protocol.https.d.getNewHttpClient(Unknown Source)\r\nat sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)\r\nat sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)\r\nat com.ibm.net.ssl.www2.protocol.https.d.connect(Unknown Source)\r\nat sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)\r\nat sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)\r\nat com.ibm.net.ssl.www2.protocol.https.b.getOutputStream(Unknown Source)\r\nat com.cloudant.http.HttpConnection.execute(HttpConnection.java:329)\r\nat com.cloudant.http.interceptors.CookieInterceptor.getCookie(CookieInterceptor.java:172)\r\nat com.cloudant.http.interceptors.CookieInterceptor.interceptRequest(CookieInterceptor.java:84)\r\nat com.cloudant.http.HttpConnection.execute(HttpConnection.java:306)\r\nat com.cloudant.client.org.lightcouch.CouchDbClient.execute(CouchDbClient.java:470)\r\nat com.cloudant.client.org.lightcouch.CouchDbClient.executeToInputStream(CouchDbClient.java:560)\r\nat com.cloudant.client.org.lightcouch.CouchDbClient.executeToResponse(CouchDbClient.java:282)\r\nat com.cloudant.client.org.lightcouch.CouchDbClient.createDB(CouchDbClient.java:204)\r\nat com.cloudant.client.org.lightcouch.CouchDatabaseBase.<init>(CouchDatabaseBase.java:63)\r\nat com.cloudant.client.org.lightcouch.CouchDatabase.<init>(CouchDatabase.java:26)\r\nat com.cloudant.client.org.lightcouch.CouchDbClient.database(CouchDbClient.java:167)\r\nat com.cloudant.client.api.CloudantClient.database(CloudantClient.java:217)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cloudant/java-cloudant/issues/comments/242365072","html_url":"https://github.com/cloudant/java-cloudant/issues/282#issuecomment-242365072","issue_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/282","id":242365072,"user":{"login":"ricellis","id":10698320,"avatar_url":"https://avatars.githubusercontent.com/u/10698320?v=3","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T12:15:45Z","updated_at":"2016-08-25T12:15:45Z","body":"OK so having investigated this a bit more and written some more tests I think the problem is that our `Proxy-Authorization` header is not added to the initial HTTP `CONNECT` request when we need to create an SSL tunnel through the proxy to an https server. The header is present on the client requests, but those are, of course, encrypted and not visible to the proxy itself.\r\n\r\nI'm not sure if there is anything we can do to the `HttpURLConnection` to make it present the credentials on a per client basis (as opposed to the global authenticator), but at the very least we should improve the documentation in this regard."}}
{"actor":{"display_login":"ricellis"}}