this could be fixed by setting followRedirects on the httpConnection as well. 

http://docs.oracle.com/javase/1.5.0/docs/api/java/net/HttpURLConnection.html#setInstanceFollowRedirects(boolean)