This small code snippet runs fine on my Mac\'s JVM. Unfortunately it crashes when executed on Android 4.2.
import java.net.HttpURLConnection; import java.net
Turned out this is a known bug in Android's class implementation. Calling Connection.setRequestProperty( "Accept-Encoding", "" ); before connecting can be used as workaround.
Connection.setRequestProperty( "Accept-Encoding", "" );
https://code.google.com/p/android/issues/detail?id=24672