@Override
    public CompletableFuture<List<DnsRecord>> resolve(DnsQuestionContext ctx, DnsQuestion question) {
        // Respect /etc/hosts as well if the record type is A or AAAA.
        final DnsRecordType type = question.type();
        final String hostname = question.name();

        if (type == DnsRecordType.A || type == DnsRecordType.AAAA) {
            final List<InetAddress> hostsFileEntries = resolveHostsFileEntries(hostname);
            if (hostsFileEntries != null) {
                final ImmutableList.Builder<DnsRecord> builder = ImmutableList.builder();
                for (InetAddress hostsFileEntry : hostsFileEntries) {
                    byte[] content = null;
                    if (hostsFileEntry instanceof Inet4Address) {
                        if (type == DnsRecordType.A) {
                            content = hostsFileEntry.getAddress();
                        }
                    } else if (hostsFileEntry instanceof Inet6Address) {
                        if (type == DnsRecordType.AAAA) {
                            content = hostsFileEntry.getAddress();
                        }
                    }
                    if (content != null) {
                        // Our current implementation does not support reloading the hosts file,
                        // so use a fairly large TTL (1 day, i.e. 86400 seconds).
                        builder.add(new ByteArrayDnsRecord(hostname, type, 86400, content));
                    }
                }
                final ImmutableList<DnsRecord> records = builder.build();
                if (!records.isEmpty()) {
                    return UnmodifiableFuture.completedFuture(records);
                }
            }
        }

        return unwrap().resolve(ctx, question);
    }
Checks whether the given hostname is the localhost/host (computer) name on Windows OS.
Windows OS removed the localhost/host (computer) name information from the hosts file in the later
versions
and such hostname cannot be resolved from hosts file.
See https://github.com/netty/netty/issues/5386
See https://github.com/netty/netty/issues/11142
core/src/main/java/com/linecorp/armeria/internal/client/dns/HostsFileDnsResolver.java