-----------------------------
protected abstract URLConnection openConnection(URL u)
throws IOException
Opens a connection to the object referenced by the URL argument. This method should be overridden by a subclass.
...............................
----------------------------------
This phrase looks a bit confusing because this method is not intended to establish connection. It should just return URLConnection instance and it's connect method is used to establish connection.
BTW, there is URL.openConnection method with similar functionality and in earlier JDK versions
it had the similar confusing description. However now it is described more clearly:
------------------------------------------
public URLConnection openConnection()
throws IOException
Returns a URLConnection instance that represents a connection to the remote object referred to by the URL.
A new instance of URLConnection is created every time when invoking the URLStreamHandler.openConnection(URL) method of the protocol handler for this URL.
It should be noted that a URLConnection instance does not establish the actual network connection on creation. This will happen only when calling URLConnection.connect().
--------------------------------------------
I think something similar should be specified for URLStreamHandler.openConnection
protected abstract URLConnection openConnection(URL u)
throws IOException
Opens a connection to the object referenced by the URL argument. This method should be overridden by a subclass.
...............................
----------------------------------
This phrase looks a bit confusing because this method is not intended to establish connection. It should just return URLConnection instance and it's connect method is used to establish connection.
BTW, there is URL.openConnection method with similar functionality and in earlier JDK versions
it had the similar confusing description. However now it is described more clearly:
------------------------------------------
public URLConnection openConnection()
throws IOException
Returns a URLConnection instance that represents a connection to the remote object referred to by the URL.
A new instance of URLConnection is created every time when invoking the URLStreamHandler.openConnection(URL) method of the protocol handler for this URL.
It should be noted that a URLConnection instance does not establish the actual network connection on creation. This will happen only when calling URLConnection.connect().
--------------------------------------------
I think something similar should be specified for URLStreamHandler.openConnection