@Override protected AFUNIXSocketAddress addressFromHost(String host, int port) throws IOException { host = stripBrackets(host); if (host.startsWith(FILE_SCHEME_PREFIX_ENCODED)) { try { host = URLDecoder.decode(host, "UTF-8"); } catch (Exception e) { throw (UnknownHostException) new UnknownHostException().initCause(e); } } if (!host.startsWith(FILE_SCHEME_PREFIX)) { throw new UnknownHostException(); } String path = host.substring(FILE_SCHEME_PREFIX.length()); if (path.isEmpty()) { throw new UnknownHostException(); } if (path.startsWith(FILE_SCHEME_LOCALHOST)) { path = path.substring(FILE_SCHEME_LOCALHOST.length()); } if (!path.startsWith("/")) { throw new UnknownHostException(); } File socketFile = new File(path); return new AFUNIXSocketAddress(socketFile, port); } }
new AFUNIXSocketFactory.URIScheme().createSocket("file://" + socketPath, port).close();
@Override protected boolean isHostnameSupported(String host) { host = stripBrackets(host); return host.startsWith(FILE_SCHEME_PREFIX) || host.startsWith(FILE_SCHEME_PREFIX_ENCODED); }