Source:
<code>public synchronized void register() throws IOException { boolean connected = false; List<DiscoveryOption> discoveryOptions = localHostInfo.getRemoteDomainControllerDiscoveryOptions(); for (Iterator<DiscoveryOption> i = discoveryOptions.iterator(); i.hasNext(); ) { DiscoveryOption discoveryOption = i.next(); final long timeout = CONNECTION_TIMEOUT; final long endTime = System.currentTimeMillis() + timeout; int retries = 0; URI masterURI = null; try { discoveryOption.discover(); <START> String host = NetworkUtils.formatPossibleIpv6Address(discoveryOption.getRemoteDomainControllerHost()); <END> int port = discoveryOption.getRemoteDomainControllerPort(); String protocol = discoveryOption.getRemoteDomainControllerProtocol(); masterURI = new URI(protocol, null, host, port, null, null, null); connection.setUri(masterURI); while (!connected) { try { connection.connect(); connected = true; } catch (IOException e) { rethrowIrrecoverableConnectionFailures(e); HostControllerLogger.ROOT_LOGGER.cannotConnect(masterURI, e); if (System.currentTimeMillis() > endTime) { throw HostControllerLogger.ROOT_LOGGER.connectionToMasterTimeout(e, retries, timeout); } try { ReconnectPolicy.CONNECT.wait(retries); retries++; } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw HostControllerLogger.ROOT_LOGGER.connectionToMasterInterrupted(); } } } HostControllerLogger.ROOT_LOGGER.connectedToMaster(masterURI); handler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, handler)); masterProxy = ExistingChannelModelControllerClient.createAndAdd(handler); txMasterProxy = new TransactionalDomainControllerClient(handler); break; } catch (Exception e) { boolean moreOptions = i.hasNext(); logConnectionException(masterURI, discoveryOption, moreOptions, e); if (!moreOptions) { throw HostControllerLogger.ROOT_LOGGER.discoveryOptionsFailureUnableToConnect(e); } } } }</code><technical_language>Enclosing IPv6 address in is needed URI constructor L248. OTOH, NetworkUtils.formatPossibleIpv6Address() more add [], canonize thing, calling ok. But, this RemoteDomainConnection.call handled consistently</technical_language>

Target:
public synchronized void register() throws IOException { boolean connected = false; List<DiscoveryOption> discoveryOptions = localHostInfo.getRemoteDomainControllerDiscoveryOptions(); for (Iterator<DiscoveryOption> i = discoveryOptions.iterator(); i.hasNext(); ) { DiscoveryOption discoveryOption = i.next(); final long timeout = CONNECTION_TIMEOUT; final long endTime = System.currentTimeMillis() + timeout; int retries = 0; URI masterURI = null; try { discoveryOption.discover(); String host = discoveryOption.getRemoteDomainControllerHost(); int port = discoveryOption.getRemoteDomainControllerPort(); String protocol = discoveryOption.getRemoteDomainControllerProtocol(); masterURI = new URI(protocol, null, host, port, null, null, null); connection.setUri(masterURI); while (!connected) { try { connection.connect(); connected = true; } catch (IOException e) { rethrowIrrecoverableConnectionFailures(e); HostControllerLogger.ROOT_LOGGER.cannotConnect(masterURI, e); if (System.currentTimeMillis() > endTime) { throw HostControllerLogger.ROOT_LOGGER.connectionToMasterTimeout(e, retries, timeout); } try { ReconnectPolicy.CONNECT.wait(retries); retries++; } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw HostControllerLogger.ROOT_LOGGER.connectionToMasterInterrupted(); } } } HostControllerLogger.ROOT_LOGGER.connectedToMaster(masterURI); handler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, handler)); masterProxy = ExistingChannelModelControllerClient.createAndAdd(handler); txMasterProxy = new TransactionalDomainControllerClient(handler); break; } catch (Exception e) { boolean moreOptions = i.hasNext(); logConnectionException(masterURI, discoveryOption, moreOptions, e); if (!moreOptions) { throw HostControllerLogger.ROOT_LOGGER.discoveryOptionsFailureUnableToConnect(e); } } } }