NacosCoordinator implements ClusterRegister, ClusterNodesQuery { @Override public void registerRemote(RemoteInstance remoteInstance) throws ServiceRegisterException { if (needUsingInternalAddr()) { remoteInstance = new RemoteInstance(new Address(config.getInternalComHost(), config.getInternalComPort(), true)); } String host = remoteInstance.getAddress().getHost(); int port = remoteInstance.getAddress().getPort(); try { namingService.registerInstance(config.getServiceName(), host, port); } catch (Exception e) { throw new ServiceRegisterException(e.getMessage()); } this.selfAddress = remoteInstance.getAddress(); } NacosCoordinator(NamingService namingService, ClusterModuleNacosConfig config); @Override List<RemoteInstance> queryRemoteNodes(); @Override void registerRemote(RemoteInstance remoteInstance);  }
@Test public void registerRemote() throws NacosException { registerRemote(remoteAddress); }
@Test public void registerSelfRemote() throws NacosException { registerRemote(selfRemoteAddress); }
@Test public void registerRemoteUsingInternal() throws NacosException { nacosConfig.setInternalComHost(internalAddress.getHost()); nacosConfig.setInternalComPort(internalAddress.getPort()); registerRemote(internalAddress); }