Response Code From Server
<pre><code>public static boolean testConnection() {
    try {
        // TODO add your handling code here:
        System.setProperty("http.proxyHost", "some proxy name");
        System.setProperty("http.proxyPort", "some port");
        URL a = new URL("http://" + Variables.serverName + ":" +           Variables.serverPort      + "/DeviceCloud");
        urlString = a.toExternalForm()+"/";
        System.out.println(urlString);
        System.out.println("http://" + Variables.serverName + ":" + Variables.serverPort + "/DeviceCloud");
        URLConnection conn = a.openConnection();
        int respCode = ((HttpURLConnection) conn).getResponseCode();
        System.out.println(respCode);
        if (respCode &gt;= 500) {
            return false;
        } else {
            return true;
        }
    } catch (Exception ex) {
        return false;
    }
}
</code></pre>

<p>It works fine if server reachable. But if server not reachable means its taking long time.
Its not showing any output.But actually the server machine is pinging from client also.
what could be right solution to get the status</p>
