(@NonNull Uri uri, Context context)
| 51 | private final static int FETCH_TIMEOUT = 15 * 1000; // milliseconds |
| 52 | |
| 53 | static Pair<InetAddress, IPInfo> getOrganization(@NonNull Uri uri, Context context) throws IOException, ParseException, JSONException { |
| 54 | String host = UriHelper.getHost(uri); |
| 55 | if (host == null) |
| 56 | throw new UnknownHostException(); |
| 57 | |
| 58 | try { |
| 59 | host = IDN.toASCII(host, IDN.ALLOW_UNASSIGNED); |
| 60 | } catch (Throwable ex) { |
| 61 | Log.i(ex); |
| 62 | } |
| 63 | |
| 64 | InetAddress address = DnsHelper.getByName(context, host); |
| 65 | return new Pair<>(address, getOrganization(address, context)); |
| 66 | } |
| 67 | |
| 68 | static IPInfo getOrganization(InetAddress address, Context context) throws IOException, JSONException { |
| 69 | synchronized (addressOrganization) { |
no test coverage detected