Changing WebSocketService test to use random port (#5)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Lucas Saldanha 6 years ago committed by GitHub
parent 1e7345ef56
commit b6d150e60e
  1. 4
      ethereum/jsonrpc/src/test/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketServiceTest.java

@ -38,6 +38,8 @@ public class WebSocketServiceTest {
vertx = Vertx.vertx(); vertx = Vertx.vertx();
websocketConfiguration = WebSocketConfiguration.createDefault(); websocketConfiguration = WebSocketConfiguration.createDefault();
websocketConfiguration.setPort(0);
final Map<String, JsonRpcMethod> websocketMethods = final Map<String, JsonRpcMethod> websocketMethods =
new WebSocketMethodsFactory(new SubscriptionManager(), new HashMap<>()).methods(); new WebSocketMethodsFactory(new SubscriptionManager(), new HashMap<>()).methods();
webSocketRequestHandlerSpy = spy(new WebSocketRequestHandler(vertx, websocketMethods)); webSocketRequestHandlerSpy = spy(new WebSocketRequestHandler(vertx, websocketMethods));
@ -45,6 +47,8 @@ public class WebSocketServiceTest {
websocketService = websocketService =
new WebSocketService(vertx, websocketConfiguration, webSocketRequestHandlerSpy); new WebSocketService(vertx, websocketConfiguration, webSocketRequestHandlerSpy);
websocketService.start().join(); websocketService.start().join();
websocketConfiguration.setPort(websocketService.socketAddress().getPort());
} }
@After @After

Loading…
Cancel
Save