private static int randomFreePort() {
    try (ServerSocket socket = new ServerSocket(0)) {
      return socket.getLocalPort();
    } catch (IOException e) {
      throw new IllegalStateException("Failed to find free server socket port.", e);
    }
  }
A Mini Raft CLuster Wrapper for Test Env.
iotdb-core/consensus/src/test/java/org/apache/iotdb/consensus/ratis/TestUtils.java