RATIS-2069. RaftMetaConf command sets incorrect peerAddress pattern. (#1075)

diff --git a/ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/local/RaftMetaConfCommand.java b/ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/local/RaftMetaConfCommand.java
index 9f0558c..e258d86 100644
--- a/ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/local/RaftMetaConfCommand.java
+++ b/ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/local/RaftMetaConfCommand.java
@@ -91,7 +91,7 @@
       }
       InetSocketAddress inetSocketAddress = parseInetSocketAddress(
           peerIdWithAddressArray[peerIdWithAddressArray.length - 1]);
-      String addressString = inetSocketAddress.toString();
+      String addressString = inetSocketAddress.getHostString() + ":" + inetSocketAddress.getPort();
       if (addresses.contains(addressString)) {
         printf("Found duplicated address: %s. Please make sure the address of peer have no duplicated value.",
             addressString);
diff --git a/ratis-test/src/test/java/org/apache/ratis/shell/cli/sh/LocalCommandIntegrationTest.java b/ratis-test/src/test/java/org/apache/ratis/shell/cli/sh/LocalCommandIntegrationTest.java
index 4a07e37..a85c247 100644
--- a/ratis-test/src/test/java/org/apache/ratis/shell/cli/sh/LocalCommandIntegrationTest.java
+++ b/ratis-test/src/test/java/org/apache/ratis/shell/cli/sh/LocalCommandIntegrationTest.java
@@ -78,11 +78,11 @@
     int index = 1;
     generateRaftConf(tempDir.resolve(RAFT_META_CONF), index);
 
-     String[] testPeersListArray = {"peer1_ID|host1:9872,peer2_ID|host2:9872,peer3_ID|host3:9872",
+     String[] testPeersListArray = {"peer1_ID|localhost:9872,peer2_ID|host2:9872,peer3_ID|host3:9872",
       "host1:9872,host2:9872,host3:9872"};
 
     for (String peersListStr : testPeersListArray) {
-      generateRaftConf(tempDir, index);
+      generateRaftConf(tempDir.resolve(RAFT_META_CONF), index);
       StringPrintStream out = new StringPrintStream();
       RatisShell shell = new RatisShell(out.getPrintStream());
       int ret = shell.run("local", "raftMetaConf", "-peers", peersListStr, "-path", tempDir.toString());
@@ -99,6 +99,11 @@
 
       Assertions.assertEquals(index + 1, indexFromNewConf);
 
+      String addressRegex = "^[a-zA-Z0-9.-]+:\\d+$";
+      Pattern pattern = Pattern.compile(addressRegex);
+      peers.forEach(p -> Assertions.assertTrue(
+          pattern.matcher(p.getAddress()).matches()));
+
       String peersListStrFromNewMetaConf;
       if (containsPeerId(peersListStr)) {
         peersListStrFromNewMetaConf = peers.stream()