Testing / UntrustedWSServer improvements
This commit is contained in:
parent
fb3124359b
commit
41d9245d9a
|
@ -23,6 +23,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -55,6 +56,7 @@ public class UntrustedWSServer extends ContainerLifeCycle implements UntrustedWS
|
|||
private URI wsUri;
|
||||
private boolean ssl = false;
|
||||
private SslContextFactory sslContextFactory;
|
||||
private Consumer<Server> serverConsumer;
|
||||
|
||||
private Map<URI, CompletableFuture<UntrustedWSSession>> onOpenFutures = new ConcurrentHashMap<>();
|
||||
private final ServletContextHandler context = new ServletContextHandler();
|
||||
|
@ -111,6 +113,12 @@ public class UntrustedWSServer extends ContainerLifeCycle implements UntrustedWS
|
|||
// Serve untrusted endpoint
|
||||
context.addServlet(UntrustedWSServlet.class, "/untrusted/*").setInitOrder(1);
|
||||
|
||||
// Allow for server customization
|
||||
if (serverConsumer != null)
|
||||
{
|
||||
serverConsumer.accept(server);
|
||||
}
|
||||
|
||||
// Start Server
|
||||
addBean(server);
|
||||
|
||||
|
@ -134,6 +142,16 @@ public class UntrustedWSServer extends ContainerLifeCycle implements UntrustedWS
|
|||
super.doStart();
|
||||
}
|
||||
|
||||
public void setServerCustomizer(Consumer<Server> customizer)
|
||||
{
|
||||
this.serverConsumer = customizer;
|
||||
}
|
||||
|
||||
public void join() throws InterruptedException
|
||||
{
|
||||
server.join();
|
||||
}
|
||||
|
||||
public URI getWsUri()
|
||||
{
|
||||
return wsUri;
|
||||
|
|
Loading…
Reference in New Issue