mirror of https://github.com/grpc/grpc-java.git
See the javadocs of ManagedChannelBuilder.forTarget(). The most interesting case is passing an IPv6 address as target. It can be either be passed as an authority, where brackets should not be escaped ([::1]), or as a path of a full URI, where brackets must be escaped (dns:///%5B::1%5D). Previously, dns:///[::1], being an invalid URI (brackets not allowed in path), would be converted to dns:////dns:///%5B::1%5D and passed to DnsNameResolver. Though it would fail eventually, the error would be very confusing to users. I changed the logic so that it would try with dns:/// only if the target string doesn't look like an intended URI target. I have restricted the "URI target" to be absolute and hierarchical, i.e., must start with scheme://. I couldn't find a way to better tell if a string is intended to be a URI, but I am open to other options. Refactored tests: - Move the tests for getNameResolver() into a separate file ManagedChannelImplGetNameResolverTest, because those tests are not quite compatible with the facility provided by ManagedChannelImplTest. - Create DnsNameResolverTest. Move DnsNameResolver out of the factory class to accommodate for the test. |
||
|---|---|---|
| .. | ||
| src | ||
| build.gradle | ||