{"action":"created","issue":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1088","repository_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client","labels_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1088/labels{/name}","comments_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1088/comments","events_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1088/events","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/1088","id":128857394,"number":1088,"title":"Exception creating WebSocket Connection from a Java Client behind a proxy","user":{"login":"SudhanshuBhatt","id":5720540,"avatar_url":"https://avatars.githubusercontent.com/u/5720540?v=3","gravatar_id":"","url":"https://api.github.com/users/SudhanshuBhatt","html_url":"https://github.com/SudhanshuBhatt","followers_url":"https://api.github.com/users/SudhanshuBhatt/followers","following_url":"https://api.github.com/users/SudhanshuBhatt/following{/other_user}","gists_url":"https://api.github.com/users/SudhanshuBhatt/gists{/gist_id}","starred_url":"https://api.github.com/users/SudhanshuBhatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SudhanshuBhatt/subscriptions","organizations_url":"https://api.github.com/users/SudhanshuBhatt/orgs","repos_url":"https://api.github.com/users/SudhanshuBhatt/repos","events_url":"https://api.github.com/users/SudhanshuBhatt/events{/privacy}","received_events_url":"https://api.github.com/users/SudhanshuBhatt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-26T15:37:46Z","updated_at":"2016-02-03T11:37:21Z","closed_at":null,"body":"**UPDATE:**\r\n**I tried the AHC 1.9.32 and 2.0.0-RC7, and was able to narrow it down to the following observations:**\r\n\r\n**1. Both versions will work with Squid proxy server, if I do not enable authentication.**\r\n**2. Both the versions fail if I make authentication mandatory.**\r\n\r\n**Version 1.9.32: Results in the Invalid Status Code 400 error.**\r\n**Version 2.0.0-RC7 : Results in a timeout after a default 6000ms.**\r\n\r\nLibrary in use: AsyncHtpClient Library: \r\nVersion : 1.9.32 and 2.0.0-RC7\r\nNetty Version : 3.10.3.Final\r\nProxy: Squid Proxy\r\n \r\nI am trying to create a websocket connection using AsyncHttpClient library. It works fine when using without the proxy. But when I start a proxy and pass in the Host, port, username and password , I am unable to create a websocket connection.\r\nIt get a stack trace which says Invalid Status Code 400:\r\n\r\nI am setting the proxy configurations using Realm in AHC:\r\n\r\nFor 1.9.32:\r\n```java\r\nRealm realm = new Realm.RealmBuilder().setPrincipal(\"user_name\").setPassword(\"password\").setScheme(Realm.AuthScheme.BASIC).build();\r\nProxyServer ps1 = new ProxyServer(\"host_address\", port_number);\r\nps1.setScheme(Realm.AuthScheme.BASIC);\r\nAsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setRealm(realm).setProxyServer(ps1).build();\r\nfinal AsyncHttpClient c = new AsyncHttpClient(config);\r\n```\r\n\r\nFor 2.0.0-RC7:\r\n```java\r\nRealm realm = new Realm.Builder(\"user_name\", \"password\").setScheme(Realm.AuthScheme.BASIC).build();\r\nProxyServer.Builder proxyBuilder = new ProxyServer.Builder(\"host_address\", port_number);\r\nproxyBuilder.setRealm(realm);\r\nProxyServer proxyServer = proxyBuilder.build();\r\nAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder().setProxyServer(proxyServer).build();\r\nfinal AsyncHttpClient c = new DefaultAsyncHttpClient(config);\r\n```\r\n\r\nAm I not configuring the Proxy correctly?"},"comment":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/comments/179179036","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/1088#issuecomment-179179036","issue_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/1088","id":179179036,"user":{"login":"thjaeckle","id":1331526,"avatar_url":"https://avatars.githubusercontent.com/u/1331526?v=3","gravatar_id":"","url":"https://api.github.com/users/thjaeckle","html_url":"https://github.com/thjaeckle","followers_url":"https://api.github.com/users/thjaeckle/followers","following_url":"https://api.github.com/users/thjaeckle/following{/other_user}","gists_url":"https://api.github.com/users/thjaeckle/gists{/gist_id}","starred_url":"https://api.github.com/users/thjaeckle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thjaeckle/subscriptions","organizations_url":"https://api.github.com/users/thjaeckle/orgs","repos_url":"https://api.github.com/users/thjaeckle/repos","events_url":"https://api.github.com/users/thjaeckle/events{/privacy}","received_events_url":"https://api.github.com/users/thjaeckle/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T11:37:21Z","updated_at":"2016-02-03T11:37:21Z","body":"Works with 2.0.0-RC8:\r\n```\r\nRequest DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: UnpooledUnsafeHeapByteBuf(freed))\r\nCONNECT events-dev.apps.bosch-iot-cloud.com:443 HTTP/1.1\r\nHost: the.host.com\r\nAuthorization: Basic blabla...\r\nProxy-Authorization: Basic foofoo...\r\nAccept: */*\r\nUser-Agent: AHC/2.0\r\n```"}}