How to close an established network connection?
<p>I have to download a file in parts. For this I am using "xxx.setRequestProperty()". But I get error saying that it cannot be used when a connection is made. So I want to close the connection which was already established using download URL.</p>

<pre><code>try {

        URL url = new URL(aurl[0]);
        URLConnection connection = url.openConnection();

        InputStream input = new BufferedInputStream(url.openStream());
        Log.d(TAG,"connected");
        int length = connection.getContentLength();
</code></pre>

<p>Now I want to close "connection". Please suggest some ways to do this.</p>
