This is an automated email from the ASF dual-hosted git repository.
ericpai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 7cf013bff3 [IOTDB-3046] Fix port binding error in ClientManagerTest
(#5736)
7cf013bff3 is described below
commit 7cf013bff3daa55f322f4da669b7172346b945bc
Author: BaiJian <[email protected]>
AuthorDate: Fri Apr 29 19:33:17 2022 +0800
[IOTDB-3046] Fix port binding error in ClientManagerTest (#5736)
---
.../src/test/java/org/apache/iotdb/commons/ClientManagerTest.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/node-commons/src/test/java/org/apache/iotdb/commons/ClientManagerTest.java
b/node-commons/src/test/java/org/apache/iotdb/commons/ClientManagerTest.java
index 54eeb70625..42f8210665 100644
--- a/node-commons/src/test/java/org/apache/iotdb/commons/ClientManagerTest.java
+++ b/node-commons/src/test/java/org/apache/iotdb/commons/ClientManagerTest.java
@@ -37,6 +37,7 @@ import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
+import java.net.InetSocketAddress;
import java.net.ServerSocket;
public class ClientManagerTest {
@@ -408,7 +409,11 @@ public class ClientManagerTest {
}
public void startServer() throws IOException {
- metaServer = new ServerSocket(9003);
+ metaServer = new ServerSocket();
+ // reuse the port to avoid `Bind Address already in use` which is caused
by TIME_WAIT state
+ // because port won't be usable immediately after we close it.
+ metaServer.setReuseAddress(true);
+ metaServer.bind(new InetSocketAddress(9003));
metaServerListeningThread =
new Thread(
() -> {