Skip to content

Commit

Permalink
Use Consumer<NativeWebSocketConfiguration> in ConnectFutureTest
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <[email protected]>
  • Loading branch information
lachlan-roberts committed Jul 15, 2020
1 parent f9750c9 commit 860cba7
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
import javax.servlet.DispatcherType;

import org.eclipse.jetty.server.Server;
Expand Down Expand Up @@ -65,13 +66,7 @@ public class ConnectFutureTest
private Server server;
private WebSocketClient client;

@FunctionalInterface
public interface Configuration
{
void configure(NativeWebSocketConfiguration configuration);
}

public void start(Configuration configuration) throws Exception
public void start(Consumer<NativeWebSocketConfiguration> configuration) throws Exception
{
server = new Server();
ServerConnector connector = new ServerConnector(server);
Expand All @@ -82,7 +77,7 @@ public void start(Configuration configuration) throws Exception
server.setHandler(contextHandler);

NativeWebSocketServletContainerInitializer.configure(contextHandler, (context, container) ->
configuration.configure(container));
configuration.accept(container));
contextHandler.addFilter(WebSocketUpgradeFilter.class, "/", EnumSet.of(DispatcherType.REQUEST));
server.start();

Expand Down

0 comments on commit 860cba7

Please sign in to comment.