How do I test connectivity to a specific host name or IP address?
<p>Please help! I wrote a method based on InetAddress and it doesn't work</p>

<p>p.s: it is not throwing exceptions or crashes. The problem is that the test.isReachable(1000) is always false therefore seems not doing anything. I did add the internet permission in Mainifest.</p>

<pre><code>public void testConnection() {
    Thread t = new Thread() {
        public void run() {
            try {
                test = InetAddress.getByName("google.com");
                if (test.isReachable(1000)) {
                    Log.e("testConnection", "I hit google! ip is:" + test.getHostAddress());
                }
            } catch (IOException e) {

            }
            mHandler.post(mUpdateResults);
        }
    };
    t.start();
}
</code></pre>
