EndpointResolver
Finds the transport endpoint for a URI's host and port. The kind of Endpoint it returns picks the endpoint's transport: an Endpoint.Udp or Endpoint.Secure its datagram transport, an Endpoint.Tcp or Endpoint.WebSocket a connection.
Errors. A lookup that fails at runtime, as a DNS lookup does without network or for a name without an address, throws CoapException with CoapException.Reason.UNRESOLVED_HOST and the underlying failure as cause: a condition that may pass. IllegalArgumentException is kept for a host this resolver cannot resolve by design, a mistake of configuration that no retry fixes, such as a host name given to Default, which knows no DNS. CoapClient passes both on, and reports any other exception of resolve as CoapException.Reason.UNRESOLVED_HOST with it as cause, so a resolver built on a platform's DNS may let that platform's exceptions through. That includes the cancellation of a lookup that times out in its own withTimeout while the caller is still active; only the caller's own cancellation passes as one.
A CoapClient does not resolve coaps URIs: without DTLS (RFC 7252 §9.1) it fails such a call with CoapException.Reason.TRANSPORT_UNAVAILABLE before the resolver runs. Nor does it resolve a coaps+tcp or coaps+ws URI unless a connector or listener of its endpoint runs TLS for that scheme, and it fails a call whose coaps+tcp or coaps+ws URI the resolver maps to a peer not reached over TLS (an Endpoint.Tcp or Endpoint.WebSocket without usesTls, or a datagram endpoint) the same way, before anything is sent (RFC 8323 §9).