public static synchronized boolean canConnect(String url) {
        boolean result = false;
        HttpURLConnection conn = null;
        try {
            conn = getNormalCon(formatUrl(url));
            conn.connect();

            int resultCode = conn.getResponseCode();
            result = (200 == resultCode);

                /*
            if (!result) {
                Log.d("canConnect", resultCode + "|" + url);
            }
            // */

        } catch (IOException e) {
            result = false;
//            Log.e("canConnect", url + "|error:" + e.toString());
        } finally {
            if (conn != null) {
                conn.disconnect();
            }
        }

        return result;
    }
public static synchronized boolean canConnect ( String url ) { boolean result = false ; HttpURLConnection conn = null ; try { conn = getNormalCon ( formatUrl ( url ) ) ; conn . connect ( ) ; int resultCode = conn . getResponseCode ( ) ; result = ( 200 == resultCode ) ; } catch ( IOException e ) { result = false ; } finally { if ( conn != null ) { conn . disconnect ( ) ; } } return result ; }
获取当前 URL 地址是否能够联通

@param url
@return