public void testRegisterDataNode() throws Exception {
    // Set up the system under test.
    CommonConfig commonConfig = Mockito.mock(CommonConfig.class);
    ConfigNodeConfig configNodeConfig = Mockito.mock(ConfigNodeConfig.class);
    ConfigNode configNode = Mockito.mock(ConfigNode.class);
    ConfigManager configManager = Mockito.mock(ConfigManager.class);
    DataNodeRegisterResp registerDataNodeResponse = new DataNodeRegisterResp();
    registerDataNodeResponse.setStatus(new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));
    registerDataNodeResponse.setConfigNodeList(
        Collections.singletonList(new TConfigNodeLocation()));
    registerDataNodeResponse.setDataNodeId(42);
    registerDataNodeResponse.setRuntimeConfiguration(new TRuntimeConfiguration());
    Mockito.when(configManager.registerDataNode(Mockito.any(TDataNodeRegisterReq.class)))
        .thenReturn(registerDataNodeResponse);
    Socket socket = Mockito.mock(Socket.class);
    Mockito.when(socket.getInetAddress())
        .thenReturn(InetAddress.getByAddress(new byte[] {1, 2, 3, 4}));
    TSocket tSocket = Mockito.mock(TSocket.class);
    Mockito.when(tSocket.getSocket()).thenReturn(socket);
    TimeoutChangeableTFastFramedTransport transport =
        Mockito.mock(TimeoutChangeableTFastFramedTransport.class);
    Mockito.when(transport.getSocket()).thenReturn(tSocket);
    ConfigNodeRPCServiceProcessor sut =
        new ConfigNodeRPCServiceProcessor(
            commonConfig, configNodeConfig, configNode, configManager);

    // Prepare the test input
    TDataNodeLocation newDataNodeLocation = new TDataNodeLocation();
    newDataNodeLocation.setDataNodeId(42);
    newDataNodeLocation.setClientRpcEndPoint(new TEndPoint("1.2.3.4", 6667));
    TDataNodeConfiguration newDataNodeConfiguration = new TDataNodeConfiguration();
    newDataNodeConfiguration.setLocation(newDataNodeLocation);
    TDataNodeRegisterReq req = new TDataNodeRegisterReq();
    req.setClusterName("test-cluster");
    req.setDataNodeConfiguration(newDataNodeConfiguration);

    // Execute the test logic
    TDataNodeRegisterResp res = sut.registerDataNode(req);

    // Check the result
    Assert.assertEquals(registerDataNodeResponse.convertToRpcDataNodeRegisterResp(), res);
    // Check that the config manager was called to register a new node
    ArgumentCaptor<TDataNodeRegisterReq> acRequest =
        ArgumentCaptor.forClass(TDataNodeRegisterReq.class);
    Mockito.verify(configManager, Mockito.times(1)).registerDataNode(acRequest.capture());
    TDataNodeRegisterReq sentRequest = acRequest.getValue();
    Assert.assertEquals(
        "1.2.3.4",
        sentRequest.getDataNodeConfiguration().getLocation().getClientRpcEndPoint().getIp());
  }
This test should be a normal data-node registration where a valid ip is used as address of the
rpc-service. Nothing special should happen here.

@throws Exception nothing should go wrong here.
iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessorTest.java