URL.openConnection
does not create the connection immediately. It only connects after you call a method that requires a connection. For example:
URL url = ...;
InputStream in = url.openStream(); // connection happens here
// you can now read the output from in