URLjava.io.IOException: Server returned HTTP response code: 411 in JAVA
<p>I'm checking whether internet is available or not </p>

<pre><code>URL url = new URL("http://www.google.co.in/");
            final HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            // set connect timeout.
            conn.setConnectTimeout(1000000);

            // set read timeout.
            conn.setReadTimeout(1000000);

            conn.setRequestMethod("POST");

            conn.setRequestProperty("Content-Type","text/xml");

            conn.setDoOutput(true);

            conn.connect();

            Integer code = conn.getResponseCode();
            final String contentType = conn.getContentType();
</code></pre>

<p>While running this code i'm getting the exception</p>

<p><code>URLjava.io.IOException: Server returned HTTP response code: 411</code></p>

<p>What could be the error.</p>
