summaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin
diff options
context:
space:
mode:
authorHaakon Dybdahl <dybdahl@yahoo-inc.com>2016-10-10 07:50:06 +0200
committerHaakon Dybdahl <dybdahl@yahoo-inc.com>2016-10-10 07:50:06 +0200
commit56adb66355bec6c9054d59d3cd75a90df9f62821 (patch)
tree3b5064b492237efa0ac63afc74b76689798e0c6e /vespaclient-container-plugin
parentba0df7f91706f52a923576bb39b5184633a2cb4e (diff)
Try to fix random port.
Diffstat (limited to 'vespaclient-container-plugin')
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java
index 71b9411cb30..ec9cdc594e9 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/DocumentApiApplicationTest.java
@@ -25,6 +25,10 @@ public class DocumentApiApplicationTest {
}
private int findRandomOpenPortOnAllLocalInterfaces() throws IOException {
- return new ServerSocket(0).getLocalPort();
+ ServerSocket socket = new ServerSocket(0);
+ socket.setReuseAddress(true);
+ int port = socket.getLocalPort();
+ socket.close();
+ return port;
}
}