Cast url.openConnection() to HttpURLConnection instead of HttpsURLConnection. Useful for enterprise githubs which does not have https set up.