Implementation HttpURLConnection too slow when running

2

I am using the HttpURLConnection class to connect to a site that returns a JSON and I have made the following encoding:

URL url = new URL("http://hmkcode.appspot.com/rest/controller/get.json");

HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();

Running the url.openConnection() and connection.connect() methods takes a long time to respond. I even have the desired return, but it takes about 5 minutes to execute the methods. Why is this happening? Remembering that I'm doing everything within the method doInBackground of a AsyncTask

    
asked by anonymous 14.08.2015 / 20:34

0 answers