Hello, everyone!
What is the common way in Java to validate and convert a string of the form host:port
into an instance of InetSocketAddress
?
It would be nice if following criteria were met:
No address lookups;
Working for IPv4, IPv6, and "string" hostnames;
(For IPv4 it'sip:port
, for IPv6 it's[ip]:port
, right? Is there some RFC which defines all these schemes?)Preferable without parsing the string by hand.
(I'm thinking about all those special cases, when someone think he knows all valid forms of socket addresses, but forgets about "that special case" which leads to unexpected results.)