summaryrefslogtreecommitdiff
path: root/same/src/main/java/com/orbekk
diff options
context:
space:
mode:
Diffstat (limited to 'same/src/main/java/com/orbekk')
-rw-r--r--same/src/main/java/com/orbekk/same/http/ServerBuilder.java1
-rw-r--r--same/src/main/java/com/orbekk/same/http/ServerContainer.java10
2 files changed, 11 insertions, 0 deletions
diff --git a/same/src/main/java/com/orbekk/same/http/ServerBuilder.java b/same/src/main/java/com/orbekk/same/http/ServerBuilder.java
index dcb7b8a..65ee670 100644
--- a/same/src/main/java/com/orbekk/same/http/ServerBuilder.java
+++ b/same/src/main/java/com/orbekk/same/http/ServerBuilder.java
@@ -33,6 +33,7 @@ public class ServerBuilder {
public ServerContainer build() {
ServerContainer server = ServerContainer.create(port);
+ server.setReuseAddress(true);
server.setContext(getServletContextHandler());
return server;
}
diff --git a/same/src/main/java/com/orbekk/same/http/ServerContainer.java b/same/src/main/java/com/orbekk/same/http/ServerContainer.java
index cd4dc4d..f91cce1 100644
--- a/same/src/main/java/com/orbekk/same/http/ServerContainer.java
+++ b/same/src/main/java/com/orbekk/same/http/ServerContainer.java
@@ -1,5 +1,7 @@
package com.orbekk.same.http;
+import org.eclipse.jetty.server.AbstractConnector;
+import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.slf4j.Logger;
@@ -27,6 +29,14 @@ public class ServerContainer {
this.context = context;
}
+ public void setReuseAddress(boolean on) {
+ Connector connector = server.getConnectors()[0];
+ if (connector instanceof AbstractConnector) {
+ AbstractConnector connector_ = (AbstractConnector)connector;
+ connector_.setReuseAddress(on);
+ }
+ }
+
public int getPort() {
if (port == 0) {
return server.getConnectors()[0].getLocalPort();