Thanks for reporting this Chris, and Alan for filing an issue to track it. That issue is: https://bugs.openjdk.java.net/browse/JDK-8225499
( which links to the IPv6-only work that Alan mentioned ) -Chris. > On 8 Jun 2019, at 07:38, Alan Bateman <alan.bate...@oracle.com> wrote: > > On 07/06/2019 19:46, Chris wrote: >> java.net.SocketAddress can represent an IPv6 address with port. >> Because parts of an IPv6 address are separated with colons and a colon >> is also used to separate the address from the port, RFC 2732 specifies >> that the address be in square brackets in this case, e.g. >> "[::1]:8080". Shouldn't that be the behavior of >> SocketAddress.toString()? Instead, it omits the square brackets. >> > Moving this to net-dev as that this where this API is maintained. > > Yes, this seems an oversight as it is always problematic to read/parse a > String that is an IPv6 literal address followed by :<port>. I suspect this > will require a small spec change to InetSocketAddress::toString. You mail is > timely as there is a lot of activity going on at this time on net-dev to > allow the JDK work in IPv6-only environments. I'll create an issue in JBS for > this. > > -Alan > !