这些天我创建了wap。我发现一个问题,如果我设置一个代理它可以连接。如果没有设置代理,则无法连接。但在此之前必须设置代理连接。
错误是:
01-23 11:04:41.400: W/System.err(9328): java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 80) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused)
01-23 11:04:41.400: W/System.err(9328): at libcore.io.IoBridge.isConnected(IoBridge.java:214)
01-23 11:04:41.410: W/System.err(9328): at libcore.io.IoBridge.connectErrno(IoBridge.java:152)
01-23 11:04:41.410: W/System.err(9328): at libcore.io.IoBridge.connect(IoBridge.java:112)
01-23 11:04:41.410: W/System.err(9328): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
01-23 11:04:41.410: W/System.err(9328): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
01-23 11:04:41.410: W/System.err(9328): at java.net.Socket.connect(Socket.java:872)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:77)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpConnection.connect(HttpConnection.java:99)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
01-23 11:04:41.410: W/System.err(9328): at libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:188)
它有HttpURLConnection 的getOutputStream()
方法错误。
只有在设置代理时有例外。谁遇到同样的问题?