Converting URLConnection to HTTPURLConnection