Java.net. SocketTimeoutException: Connection timed out
At org. apache. harmony. luni. platform. OSNetworkSystem. connect (Native Method)
At dalvik. system. BlockGuard $ WrappedNetworkSystem. connect (BlockGuard. java: 357)
At org.apache.harmony.luni.net. PlainSocketImpl. connect (PlainSocketImpl. java: 204)
At org.apache.harmony.luni.net. PlainSocketImpl. connect (PlainSocketImpl. java: 437)
At java.net. Socket. connect (Socket. java: 983)
At org.apache.harmony.luni.internal.net. www. protocol. http. HttpConnection. <init> (HttpConnection. java: 75)
At org.apache.harmony.luni.internal.net. www. protocol. http. HttpConnection. <init> (HttpConnection. java: 48)
At org.apache.harmony.luni.internal.net. www. protocol. http. HttpConnection $ Address. connect (HttpConnection. java: 322)
At org.apache.harmony.luni.internal.net. www. protocol. http. HttpConnectionPool. get (HttpConnectionPool. java: 89)
At org.apache.harmony.luni.internal.net. www.protocol. http. HttpURLConnectionImpl. getHttpConnection (HttpURLConnectionImpl. java: 285)
At org.apache.harmony.luni.internal.net. www. protocol. http. HttpURLConnectionImpl. makeConnection (HttpURLConnectionImpl. java: 267)
At org.apache.harmony.luni.internal.net. www. protocol. http. HttpURLConnectionImpl. retrieveResponse (HttpURLConnectionImpl. java: 1018)
At org.apache.harmony.luni.internal.net. www. protocol. http. HttpURLConnectionImpl. getResponseCode (HttpURLConnectionImpl. java: 726)
At test. NewsTest. testNetConn (NewsTest. java: 35)
At java. lang. reflect. Method. invokeNative (Native Method)
At android. test. AndroidTestRunner. runTest (AndroidTestRunner. java: 169)
At android. test. AndroidTestRunner. runTest (AndroidTestRunner. java: 154)
At android. test. InstrumentationTestRunner. onStart (InstrumentationTestRunner. java: 529)
At android. app. Instrumentation $ InstrumentationThread. run (Instrumentation. java: 1448)
The cause of the above error message is summarized as follows:
1. At that time, I forgot to enable the virtual wifi of my computer win7;
2. Another reason is that if you write a web application by yourself, check whether the service has been released and started;
3. Check whether your URL is correct;
In a word, the error message is "connection timeout", which is definitely a problem related to the (network) connection. Just find the cause carefully, hope it will help beginners!