in common/src/main/java/org/mvndaemon/mvnd/common/SocketFamily.java [70:107]
public static SocketAddress fromString(String str) {
if (str.startsWith("inet:")) {
String s = str.substring("inet:".length());
int ic = s.lastIndexOf(':');
String ia = s.substring(0, ic);
int is = ia.indexOf('/');
String h = ia.substring(0, is);
String a = ia.substring(is + 1);
String p = s.substring(ic + 1);
InetAddress addr;
if ("<unresolved>".equals(a)) {
return InetSocketAddress.createUnresolved(h, Integer.parseInt(p));
} else {
if (a.indexOf('.') > 0) {
String[] as = a.split("\\.");
if (as.length != 4) {
throw new IllegalArgumentException("Unsupported socket address: '" + str + "'");
}
byte[] ab = new byte[4];
for (int i = 0; i < 4; i++) {
ab[i] = (byte) Integer.parseInt(as[i]);
}
try {
addr = InetAddress.getByAddress(h.isEmpty() ? null : h, ab);
} catch (UnknownHostException e) {
throw new IllegalArgumentException("Unsupported address: " + str, e);
}
} else {
throw new IllegalArgumentException("Unsupported address: " + str);
}
return new InetSocketAddress(addr, Integer.parseInt(p));
}
} else if (str.startsWith("unix:")) {
return SocketHelper.unixSocketAddressOf(str.substring("unix:".length()));
} else {
throw new IllegalArgumentException("Unsupported socket address: '" + str + "'");
}
}