changed Connection object from HttpURLConnection to URLConnection