public void testRestartDataNode() 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);
    TDataNodeRestartResp restartDataNodeResponse = new TDataNodeRestartResp();
    restartDataNodeResponse.setStatus(new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));
    restartDataNodeResponse.setConfigNodeList(Collections.singletonList(new TConfigNodeLocation()));
    restartDataNodeResponse.setRuntimeConfiguration(new TRuntimeConfiguration());
    Mockito.when(configManager.restartDataNode(Mockito.any(TDataNodeRestartReq.class)))
        .thenReturn(restartDataNodeResponse);
    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);
    TDataNodeRestartReq req = new TDataNodeRestartReq();
    req.setClusterName("test-cluster");
    req.setDataNodeConfiguration(newDataNodeConfiguration);

    // Execute the test logic
    TDataNodeRestartResp res = sut.restartDataNode(req);

    // Check the result
    Assert.assertEquals(restartDataNodeResponse, res);
    // Check that the config manager was called to register a new node
    ArgumentCaptor<TDataNodeRestartReq> acRequest =
        ArgumentCaptor.forClass(TDataNodeRestartReq.class);
    Mockito.verify(configManager, Mockito.times(1)).restartDataNode(acRequest.capture());
    TDataNodeRestartReq sentRequest = acRequest.getValue();
    // In this case we expect the ConfigNodeRPCServiceProcessor to have replaced the
    // ip of "0.0.0.0" with the IP it got the request from.
    Assert.assertEquals(
        "1.2.3.4",
        sentRequest.getDataNodeConfiguration().getLocation().getClientRpcEndPoint().getIp());
  }
This test should be a normal data-node restart 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