Currently, there is no statement in the spec regarding the behavior if IPv6
addresses are not supported in underlying OS. It makes it difficult for
developers to write applications using IPv6 addresses while taking into account
that IPv6 may not be supported in OS.
The behavior of latest implementation shows that IOException will be thrown when
a Socket connection is made using an IPv6 address if the OS does not support
IPv6:
java.net.ConnectException: connect: Address is invalid on local machine, or port
is not valid on remote machine
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:348)
at java.net.Socket.connect(Socket.java:505)
at java.net.Socket.connect(Socket.java:455)
at java.net.Socket.<init>(Socket.java:363)
at java.net.Socket.<init>(Socket.java:178)
Such behavior should be specified in java.net package level description as well
as the constructor of Socket.