diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/ExpectNetServicesReturnsAllServicesAsActive.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/ExpectNetServicesReturnsAllServicesAsActive.java index 77a822b064..32033bb640 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/ExpectNetServicesReturnsAllServicesAsActive.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/ExpectNetServicesReturnsAllServicesAsActive.java @@ -44,12 +44,10 @@ public class ExpectNetServicesReturnsAllServicesAsActive implements Condition { assertThat(InetAddresses.isUriInetAddress(result.get("ws").get("host"))).isTrue(); final int wsPort = Integer.valueOf(result.get("ws").get("port")); - // TODO: Port should not be 0-valued. Refer to PAN-2703 - assertThat(NetworkUtility.isValidPort(p2pPort) || wsPort == 0).isTrue(); + assertThat(NetworkUtility.isValidPort(wsPort)).isTrue(); assertThat(InetAddresses.isUriInetAddress(result.get("jsonrpc").get("host"))).isTrue(); final int jsonRpcPort = Integer.valueOf(result.get("jsonrpc").get("port")); - // TODO: Port should not be 0-valued. Refer to PAN-2703 - assertThat(NetworkUtility.isValidPort(p2pPort) || jsonRpcPort == 0).isTrue(); + assertThat(NetworkUtility.isValidPort(jsonRpcPort)).isTrue(); } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/ExpectNetServicesReturnsOnlyJsonRpcActive.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/ExpectNetServicesReturnsOnlyJsonRpcActive.java index 65202cc5b2..4bac13f3dd 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/ExpectNetServicesReturnsOnlyJsonRpcActive.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/ExpectNetServicesReturnsOnlyJsonRpcActive.java @@ -40,7 +40,6 @@ public class ExpectNetServicesReturnsOnlyJsonRpcActive implements Condition { assertThat(InetAddresses.isUriInetAddress(result.get("jsonrpc").get("host"))).isTrue(); final int jsonrpcPort = Integer.valueOf(result.get("jsonrpc").get("port")); - // TODO: Port should not be 0-valued. Refer to PAN-2703 - assertThat(NetworkUtility.isValidPort(jsonrpcPort) || jsonrpcPort == 0).isTrue(); + assertThat(NetworkUtility.isValidPort(jsonrpcPort)).isTrue(); } } diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java index 08c3942649..31af542ec8 100755 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java @@ -203,10 +203,10 @@ public class JsonRpcHttpService { res -> { if (!res.failed()) { resultFuture.complete(null); + final int actualPort = httpServer.actualPort(); LOG.info( - "JsonRPC service started and listening on {}:{}", - config.getHost(), - httpServer.actualPort()); + "JsonRPC service started and listening on {}:{}", config.getHost(), actualPort); + config.setPort(actualPort); return; } httpServer = null; diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/WebSocketService.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/WebSocketService.java index 984aceeefe..7158421802 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/WebSocketService.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/WebSocketService.java @@ -178,11 +178,12 @@ public class WebSocketService { return res -> { if (res.succeeded()) { + final int actualPort = res.result().actualPort(); LOG.info( "Websocket service started and listening on {}:{}", configuration.getHost(), - res.result().actualPort()); - + actualPort); + configuration.setPort(actualPort); resultFuture.complete(null); } else { resultFuture.completeExceptionally(res.cause());