diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 4fed43166..dd1c678ef 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -16,4 +16,4 @@ jobs: cache: 'maven' github-token: ${{ secrets.GITHUB_TOKEN }} - name: Build with Maven - run: ./mvnw -batch-mode clean install -Ppre --file pom.xml + run: ./mvnw -batch-mode clean install -Dforks=4 -Ppre --file pom.xml diff --git a/fireflies/src/main/java/com/salesforce/apollo/fireflies/Binding.java b/fireflies/src/main/java/com/salesforce/apollo/fireflies/Binding.java index 133bc29da..91597bb46 100644 --- a/fireflies/src/main/java/com/salesforce/apollo/fireflies/Binding.java +++ b/fireflies/src/main/java/com/salesforce/apollo/fireflies/Binding.java @@ -333,8 +333,7 @@ private Registration registration() { private NoteWrapper seedFor(Seed seed) { SignedNote seedNote = SignedNote.newBuilder() .setNote(Note.newBuilder() - .setHost(seed.endpoint().getHostName()) - .setPort(seed.endpoint().getPort()) + .setEndpoint(seed.endpoint()) .setIdentifier(seed.identifier().toIdent()) .setEpoch(-1) .setMask(ByteString.copyFrom( diff --git a/fireflies/src/main/java/com/salesforce/apollo/fireflies/NoteWrapper.java b/fireflies/src/main/java/com/salesforce/apollo/fireflies/NoteWrapper.java index b180e64da..4459a6e91 100644 --- a/fireflies/src/main/java/com/salesforce/apollo/fireflies/NoteWrapper.java +++ b/fireflies/src/main/java/com/salesforce/apollo/fireflies/NoteWrapper.java @@ -40,6 +40,10 @@ public Digest currentView() { return currentView; } + public String getEndpoint() { + return note.getNote().getEndpoint(); + } + public long getEpoch() { return note.getNote().getEpoch(); } @@ -48,10 +52,6 @@ public Digest getHash() { return hash; } - public String getHost() { - return note.getNote().getHost(); - } - public Digest getId() { return getIdentifier().getDigest(); } @@ -64,10 +64,6 @@ public BitSet getMask() { return mask; } - public int getPort() { - return note.getNote().getPort(); - } - public JohnHancock getSignature() { return signature(note.getSignature()); } diff --git a/fireflies/src/main/java/com/salesforce/apollo/fireflies/View.java b/fireflies/src/main/java/com/salesforce/apollo/fireflies/View.java index 8c09f2e3e..7b2b499b2 100644 --- a/fireflies/src/main/java/com/salesforce/apollo/fireflies/View.java +++ b/fireflies/src/main/java/com/salesforce/apollo/fireflies/View.java @@ -51,8 +51,6 @@ import org.slf4j.LoggerFactory; import java.io.InputStream; -import java.net.InetSocketAddress; -import java.net.SocketAddress; import java.time.Duration; import java.util.*; import java.util.concurrent.*; @@ -113,14 +111,14 @@ public class View { private final Verifiers verifiers; private volatile ScheduledFuture futureGossip; - public View(DynamicContext context, ControlledIdentifierMember member, InetSocketAddress endpoint, + public View(DynamicContext context, ControlledIdentifierMember member, String endpoint, EventValidation validation, Verifiers verifiers, Router communications, Parameters params, DigestAlgorithm digestAlgo, FireflyMetrics metrics) { this(context, member, endpoint, validation, verifiers, communications, params, communications, digestAlgo, metrics); } - public View(DynamicContext context, ControlledIdentifierMember member, InetSocketAddress endpoint, + public View(DynamicContext context, ControlledIdentifierMember member, String endpoint, EventValidation validation, Verifiers verifiers, Router communications, Parameters params, Router gateway, DigestAlgorithm digestAlgo, FireflyMetrics metrics) { this.metrics = metrics; @@ -1481,19 +1479,18 @@ private boolean verify(SelfAddressingIdentifier id, SigningThreshold threshold, return verifier.get().verify(threshold, signature, message); } - public record Seed(SelfAddressingIdentifier identifier, InetSocketAddress endpoint) { + public record Seed(SelfAddressingIdentifier identifier, String endpoint) { } public class Node extends Participant implements SigningMember { private final ControlledIdentifierMember wrapped; - public Node(ControlledIdentifierMember wrapped, InetSocketAddress endpoint) { + public Node(ControlledIdentifierMember wrapped, String endpoint) { super(wrapped.getId()); this.wrapped = wrapped; var n = Note.newBuilder() .setEpoch(0) - .setHost(endpoint.getHostName()) - .setPort(endpoint.getPort()) + .setEndpoint(endpoint) .setIdentifier(wrapped.getIdentifier().getIdentifier().toIdent()) .setMask(ByteString.copyFrom(nextMask().toByteArray())) .build(); @@ -1656,8 +1653,7 @@ void reset() { var n = Note.newBuilder() .setEpoch(0) .setCurrentView(currentView().toDigeste()) - .setHost(current.getHost()) - .setPort(current.getPort()) + .setEndpoint(current.getEndpoint()) .setIdentifier(current.getIdentifier().toIdent()) .setMask(ByteString.copyFrom(nextMask().toByteArray())) .build(); @@ -1693,12 +1689,12 @@ public int compareTo(Member o) { return id.compareTo(o.getId()); } - public SocketAddress endpoint() { + public String endpoint() { final var current = note; if (current == null) { return null; } - return new InetSocketAddress(current.getHost(), current.getPort()); + return current.getEndpoint(); } @Override diff --git a/fireflies/src/test/java/com/salesforce/apollo/fireflies/ChurnTest.java b/fireflies/src/test/java/com/salesforce/apollo/fireflies/ChurnTest.java index 5eeee0e4a..2c9af24ef 100644 --- a/fireflies/src/test/java/com/salesforce/apollo/fireflies/ChurnTest.java +++ b/fireflies/src/test/java/com/salesforce/apollo/fireflies/ChurnTest.java @@ -8,10 +8,7 @@ import com.codahale.metrics.ConsoleReporter; import com.codahale.metrics.MetricRegistry; -import com.salesforce.apollo.archipelago.LocalServer; -import com.salesforce.apollo.archipelago.Router; -import com.salesforce.apollo.archipelago.ServerConnectionCache; -import com.salesforce.apollo.archipelago.ServerConnectionCacheMetricsImpl; +import com.salesforce.apollo.archipelago.*; import com.salesforce.apollo.context.DynamicContext; import com.salesforce.apollo.cryptography.Digest; import com.salesforce.apollo.cryptography.DigestAlgorithm; @@ -27,7 +24,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.net.InetSocketAddress; import java.security.SecureRandom; import java.time.Duration; import java.util.*; @@ -93,10 +89,9 @@ public void churn() throws Exception { System.out.println(); System.out.println("Starting views"); System.out.println(); - var seeds = members.values() .stream() - .map(m -> new Seed(m.getIdentifier().getIdentifier(), new InetSocketAddress(0))) + .map(m -> new Seed(m.getIdentifier().getIdentifier(), EndpointProvider.allocatePort())) .limit(25) .toList(); @@ -289,8 +284,8 @@ private void initialize() { gateway.start(); gateways.add(comms); - return new View(context, node, new InetSocketAddress(0), EventValidation.NONE, Verifiers.from(kerl), comms, - parameters, gateway, DigestAlgorithm.DEFAULT, metrics); + return new View(context, node, EndpointProvider.allocatePort(), EventValidation.NONE, Verifiers.from(kerl), + comms, parameters, gateway, DigestAlgorithm.DEFAULT, metrics); }).collect(Collectors.toList()); } } diff --git a/fireflies/src/test/java/com/salesforce/apollo/fireflies/E2ETest.java b/fireflies/src/test/java/com/salesforce/apollo/fireflies/E2ETest.java index 73f69cbc7..1b72a86a9 100644 --- a/fireflies/src/test/java/com/salesforce/apollo/fireflies/E2ETest.java +++ b/fireflies/src/test/java/com/salesforce/apollo/fireflies/E2ETest.java @@ -8,10 +8,7 @@ import com.codahale.metrics.ConsoleReporter; import com.codahale.metrics.MetricRegistry; -import com.salesforce.apollo.archipelago.LocalServer; -import com.salesforce.apollo.archipelago.Router; -import com.salesforce.apollo.archipelago.ServerConnectionCache; -import com.salesforce.apollo.archipelago.ServerConnectionCacheMetricsImpl; +import com.salesforce.apollo.archipelago.*; import com.salesforce.apollo.context.DynamicContext; import com.salesforce.apollo.cryptography.Digest; import com.salesforce.apollo.cryptography.DigestAlgorithm; @@ -27,7 +24,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.net.InetSocketAddress; import java.security.SecureRandom; import java.time.Duration; import java.util.*; @@ -102,7 +98,7 @@ public void smokin() throws Exception { final var seeds = members.values() .stream() - .map(m -> new Seed(m.getIdentifier().getIdentifier(), new InetSocketAddress(0))) + .map(m -> new Seed(m.getIdentifier().getIdentifier(), EndpointProvider.allocatePort())) .limit(largeTests ? 10 : 1) .toList(); final var bootstrapSeed = seeds.subList(0, 1); @@ -206,8 +202,8 @@ private void initialize() { gateway.start(); gateways.add(comms); - return new View(context, node, new InetSocketAddress(0), EventValidation.NONE, Verifiers.from(kerl), comms, - parameters, gateway, DigestAlgorithm.DEFAULT, metrics); + return new View(context, node, EndpointProvider.allocatePort(), EventValidation.NONE, Verifiers.from(kerl), + comms, parameters, gateway, DigestAlgorithm.DEFAULT, metrics); }).collect(Collectors.toList()); } diff --git a/fireflies/src/test/java/com/salesforce/apollo/fireflies/MtlsTest.java b/fireflies/src/test/java/com/salesforce/apollo/fireflies/MtlsTest.java index 02b47217e..bc805d703 100644 --- a/fireflies/src/test/java/com/salesforce/apollo/fireflies/MtlsTest.java +++ b/fireflies/src/test/java/com/salesforce/apollo/fireflies/MtlsTest.java @@ -32,9 +32,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.SocketAddress; import java.security.Provider; import java.security.SecureRandom; import java.security.cert.X509Certificate; @@ -59,7 +56,7 @@ public class MtlsTest { private static final int CARDINALITY; private static final Map certs = new HashMap<>(); - private static final Map endpoints = new HashMap<>(); + private static final Map endpoints = new HashMap<>(); private static final boolean LARGE_TESTS = Boolean.getBoolean( "large_tests"); private static Map> identities; @@ -75,19 +72,21 @@ public class MtlsTest { public static void beforeClass() throws Exception { var entropy = SecureRandom.getInstance("SHA1PRNG"); entropy.setSeed(new byte[] { 6, 6, 6 }); - String localhost = InetAddress.getLoopbackAddress().getHostName(); var stereotomy = new StereotomyImpl(new MemKeyStore(), new MemKERL(DigestAlgorithm.DEFAULT), entropy); identities = IntStream.range(0, CARDINALITY).mapToObj(i -> { return stereotomy.newIdentifier(); }).collect(Collectors.toMap(controlled -> controlled.getIdentifier().getDigest(), controlled -> controlled)); identities.entrySet().forEach(e -> { - InetSocketAddress endpoint = new InetSocketAddress(localhost, Utils.allocatePort()); certs.put(e.getKey(), e.getValue().provision(Instant.now(), Duration.ofDays(1), SignatureAlgorithm.DEFAULT)); - endpoints.put(e.getKey(), endpoint); + endpoints.put(e.getKey(), EndpointProvider.allocatePort()); }); } + private static String endpoint(Member m) { + return ((Participant) m).endpoint(); + } + @AfterEach public void after() { if (views != null) { @@ -117,7 +116,6 @@ public void smoke() throws Exception { var builder = ServerConnectionCache.newBuilder().setTarget(30); var frist = new AtomicBoolean(true); - Function resolver = m -> ((Participant) m).endpoint(); var clientContextSupplier = clientContextSupplier(); views = members.stream().map(node -> { @@ -125,7 +123,7 @@ public void smoke() throws Exception { FireflyMetricsImpl metrics = new FireflyMetricsImpl(context.getId(), frist.getAndSet(false) ? node0Registry : registry); EndpointProvider ep = new StandardEpProvider(endpoints.get(node.getId()), ClientAuth.REQUIRE, - CertificateValidator.NONE, resolver); + CertificateValidator.NONE, MtlsTest::endpoint); builder.setMetrics(new ServerConnectionCacheMetricsImpl(frist.getAndSet(false) ? node0Registry : registry)); CertificateWithPrivateKey certWithKey = certs.get(node.getId()); Router comms = new MtlsServer(node, ep, clientContextSupplier, serverContextSupplier(certWithKey)).router( diff --git a/fireflies/src/test/java/com/salesforce/apollo/fireflies/SwarmTest.java b/fireflies/src/test/java/com/salesforce/apollo/fireflies/SwarmTest.java index 11d8c6440..ddb713b19 100644 --- a/fireflies/src/test/java/com/salesforce/apollo/fireflies/SwarmTest.java +++ b/fireflies/src/test/java/com/salesforce/apollo/fireflies/SwarmTest.java @@ -8,10 +8,7 @@ import com.codahale.metrics.ConsoleReporter; import com.codahale.metrics.MetricRegistry; -import com.salesforce.apollo.archipelago.LocalServer; -import com.salesforce.apollo.archipelago.Router; -import com.salesforce.apollo.archipelago.ServerConnectionCache; -import com.salesforce.apollo.archipelago.ServerConnectionCacheMetricsImpl; +import com.salesforce.apollo.archipelago.*; import com.salesforce.apollo.context.DynamicContext; import com.salesforce.apollo.cryptography.Digest; import com.salesforce.apollo.cryptography.DigestAlgorithm; @@ -27,7 +24,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.net.InetSocketAddress; import java.security.SecureRandom; import java.time.Duration; import java.util.*; @@ -103,7 +99,7 @@ public void swarm() throws Exception { final var seeds = members.values() .stream() - .map(m -> new Seed(m.getIdentifier().getIdentifier(), new InetSocketAddress(0))) + .map(m -> new Seed(m.getIdentifier().getIdentifier(), EndpointProvider.allocatePort())) .limit(largeTests ? 100 : 10) .toList(); final var bootstrapSeed = seeds.subList(0, 1); @@ -241,8 +237,8 @@ private void initialize() { gateway.start(); gateways.add(comms); - return new View(context, node, new InetSocketAddress(0), EventValidation.NONE, Verifiers.from(kerl), comms, - parameters, gateway, DigestAlgorithm.DEFAULT, metrics); + return new View(context, node, EndpointProvider.allocatePort(), EventValidation.NONE, Verifiers.from(kerl), + comms, parameters, gateway, DigestAlgorithm.DEFAULT, metrics); }).collect(Collectors.toList()); } } diff --git a/grpc/src/main/proto/fireflies.proto b/grpc/src/main/proto/fireflies.proto index b094959fb..44398361a 100644 --- a/grpc/src/main/proto/fireflies.proto +++ b/grpc/src/main/proto/fireflies.proto @@ -48,8 +48,7 @@ message Note { crypto.Digeste currentView = 2; stereotomy.Ident identifier = 3; bytes mask = 4; - string host = 5; - int32 port = 6; + string endpoint = 5; } message ViewChange { diff --git a/isolates/src/test/java/com/salesforce/apollo/demesnes/FireFliesTrace.java b/isolates/src/test/java/com/salesforce/apollo/demesnes/FireFliesTrace.java index d2d0bcd55..8e2a95111 100644 --- a/isolates/src/test/java/com/salesforce/apollo/demesnes/FireFliesTrace.java +++ b/isolates/src/test/java/com/salesforce/apollo/demesnes/FireFliesTrace.java @@ -6,6 +6,7 @@ */ package com.salesforce.apollo.demesnes; +import com.salesforce.apollo.archipelago.EndpointProvider; import com.salesforce.apollo.archipelago.LocalServer; import com.salesforce.apollo.archipelago.Router; import com.salesforce.apollo.archipelago.ServerConnectionCache; @@ -31,7 +32,6 @@ import com.salesforce.apollo.utils.Entropy; import com.salesforce.apollo.utils.Utils; -import java.net.InetSocketAddress; import java.nio.file.Path; import java.security.SecureRandom; import java.time.Duration; @@ -208,7 +208,7 @@ public void before() throws Exception { .setContext(context) .setCommunications( localRouter), - new InetSocketAddress(0), commsDirectory, ffParams, + EndpointProvider.allocatePort(), commsDirectory, ffParams, IdentifierSpecification.newBuilder(), null); domains.add(node); routers.put(node, localRouter); @@ -221,7 +221,7 @@ public void smokin() throws Exception { long then = System.currentTimeMillis(); final var countdown = new CountDownLatch(domains.size()); final var seeds = Collections.singletonList( - new Seed(domains.getFirst().getMember().getIdentifier().getIdentifier(), new InetSocketAddress(0))); + new Seed(domains.getFirst().getMember().getIdentifier().getIdentifier(), EndpointProvider.allocatePort())); domains.forEach(d -> { BiConsumer c = (context, viewId) -> { if (context.cardinality() == CARDINALITY) { diff --git a/memberships/src/main/java/com/salesforce/apollo/archipelago/EndpointProvider.java b/memberships/src/main/java/com/salesforce/apollo/archipelago/EndpointProvider.java index f76eac2c3..b3fb1b0b8 100644 --- a/memberships/src/main/java/com/salesforce/apollo/archipelago/EndpointProvider.java +++ b/memberships/src/main/java/com/salesforce/apollo/archipelago/EndpointProvider.java @@ -6,18 +6,28 @@ */ package com.salesforce.apollo.archipelago; -import java.net.SocketAddress; - +import com.google.common.net.HostAndPort; import com.salesforce.apollo.cryptography.ssl.CertificateValidator; import com.salesforce.apollo.membership.Member; - +import com.salesforce.apollo.utils.Utils; import io.netty.handler.ssl.ClientAuth; +import java.net.InetSocketAddress; +import java.net.SocketAddress; + /** * @author hal.hildebrand - * */ public interface EndpointProvider { + static String allocatePort() { + var addr = new InetSocketAddress(Utils.allocatePort()); + return HostAndPort.fromParts(addr.getHostName(), addr.getPort()).toString(); + } + + static T reify(String encoded) { + var hnp = HostAndPort.fromString(encoded); + return (T) new InetSocketAddress(hnp.getHost(), hnp.getPort()); + } SocketAddress addressFor(Member to); @@ -27,6 +37,6 @@ public interface EndpointProvider { ClientAuth getClientAuth(); - CertificateValidator getValiator(); + CertificateValidator getValidator(); } diff --git a/memberships/src/main/java/com/salesforce/apollo/archipelago/MtlsServer.java b/memberships/src/main/java/com/salesforce/apollo/archipelago/MtlsServer.java index 6c4afd83a..0a800fa92 100644 --- a/memberships/src/main/java/com/salesforce/apollo/archipelago/MtlsServer.java +++ b/memberships/src/main/java/com/salesforce/apollo/archipelago/MtlsServer.java @@ -31,6 +31,8 @@ import io.netty.handler.ssl.ApplicationProtocolConfig.Protocol; import io.netty.handler.ssl.ApplicationProtocolConfig.SelectedListenerFailureBehavior; import io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.net.ssl.SSLException; import javax.net.ssl.SSLPeerUnverifiedException; @@ -51,15 +53,17 @@ * @author hal.hildebrand */ public class MtlsServer implements RouterSupplier { - static final String TL_SV1_3 = "TLSv1.3"; - private static final Provider PROVIDER_JSSE = Security.getProvider("SunJSSE"); - private final LoadingCache cachedMembership; - private final Function contextSupplier; - private final EndpointProvider epProvider; - private final Member from; - private final Context.Key sslSessionContext = Context.key("SSLSession"); - private final ServerContextSupplier supplier; - private final Executor executor; + static final String TL_SV1_3 = "TLSv1.3"; + private static final Provider PROVIDER_JSSE = Security.getProvider("SunJSSE"); + private static final Logger log = LoggerFactory.getLogger(MtlsServer.class); + + private final LoadingCache cachedMembership; + private final Function contextSupplier; + private final EndpointProvider epProvider; + private final Member from; + private final Context.Key sslSessionContext = Context.key("SSLSession"); + private final ServerContextSupplier supplier; + private final Executor executor; public MtlsServer(Member from, EndpointProvider epProvider, Function contextSupplier, ServerContextSupplier supplier) { @@ -148,7 +152,7 @@ public RouterImpl router(ServerConnectionCache.Builder cacheBuilder, Supplier
  • resolver; - private final CertificateValidator validator; + private final SocketAddress bindAddress; + private final ClientAuth clientAuth; + private final Function resolver; + private final CertificateValidator validator; - public StandardEpProvider(SocketAddress bindAddress, ClientAuth clientAuth, CertificateValidator validator, - Function resolver) { - this.bindAddress = bindAddress; + public StandardEpProvider(String bindAddress, ClientAuth clientAuth, CertificateValidator validator, + Function resolver) { + this.bindAddress = EndpointProvider.reify(bindAddress); this.clientAuth = clientAuth; this.validator = validator; this.resolver = resolver; @@ -35,7 +33,7 @@ public StandardEpProvider(SocketAddress bindAddress, ClientAuth clientAuth, Cert @Override public SocketAddress addressFor(Member to) { - return resolver.apply(to); + return EndpointProvider.reify(resolver.apply(to)); } @Override @@ -54,8 +52,7 @@ public ClientAuth getClientAuth() { } @Override - public CertificateValidator getValiator() { + public CertificateValidator getValidator() { return validator; } - } diff --git a/model/src/main/java/com/salesforce/apollo/model/ProcessContainerDomain.java b/model/src/main/java/com/salesforce/apollo/model/ProcessContainerDomain.java index 6a8f61c83..602b910a8 100644 --- a/model/src/main/java/com/salesforce/apollo/model/ProcessContainerDomain.java +++ b/model/src/main/java/com/salesforce/apollo/model/ProcessContainerDomain.java @@ -38,7 +38,6 @@ import org.slf4j.LoggerFactory; import java.io.IOException; -import java.net.InetSocketAddress; import java.nio.file.Path; import java.time.Duration; import java.util.*; @@ -72,7 +71,7 @@ public class ProcessContainerDomain extends ProcessDomain { public ProcessContainerDomain(Digest group, ControlledIdentifierMember member, ProcessDomainParameters parameters, Parameters.Builder builder, Parameters.RuntimeParameters.Builder runtime, - InetSocketAddress endpoint, Path commDirectory, + String endpoint, Path commDirectory, com.salesforce.apollo.fireflies.Parameters.Builder ff, IdentifierSpecification.Builder subDomainSpecification, StereotomyMetrics stereotomyMetrics) { diff --git a/model/src/main/java/com/salesforce/apollo/model/ProcessDomain.java b/model/src/main/java/com/salesforce/apollo/model/ProcessDomain.java index b3f1cd90b..7bcc251b8 100644 --- a/model/src/main/java/com/salesforce/apollo/model/ProcessDomain.java +++ b/model/src/main/java/com/salesforce/apollo/model/ProcessDomain.java @@ -25,7 +25,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.net.InetSocketAddress; import java.nio.file.Path; import java.time.Duration; import java.time.Instant; @@ -55,7 +54,7 @@ public class ProcessDomain extends Domain { private final BiConsumer listener = listener(); public ProcessDomain(Digest group, ControlledIdentifierMember member, ProcessDomainParameters pdParams, - Builder builder, Parameters.RuntimeParameters.Builder runtime, InetSocketAddress endpoint, + Builder builder, Parameters.RuntimeParameters.Builder runtime, String endpoint, com.salesforce.apollo.fireflies.Parameters.Builder ff, StereotomyMetrics stereotomyMetrics) { super(member, builder, pdParams.dbURL, pdParams.checkpointBaseDir, runtime); parameters = pdParams; diff --git a/model/src/test/java/com/salesforce/apollo/model/ContainmentDomainTest.java b/model/src/test/java/com/salesforce/apollo/model/ContainmentDomainTest.java index b4e85a6a8..c316dd9d7 100644 --- a/model/src/test/java/com/salesforce/apollo/model/ContainmentDomainTest.java +++ b/model/src/test/java/com/salesforce/apollo/model/ContainmentDomainTest.java @@ -6,6 +6,7 @@ */ package com.salesforce.apollo.model; +import com.salesforce.apollo.archipelago.EndpointProvider; import com.salesforce.apollo.archipelago.LocalServer; import com.salesforce.apollo.archipelago.Router; import com.salesforce.apollo.archipelago.ServerConnectionCache; @@ -30,7 +31,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.net.InetSocketAddress; import java.nio.file.Path; import java.security.SecureRandom; import java.time.Duration; @@ -96,7 +96,7 @@ public void before() throws Exception { .setFoundation(sealed) .setContext(context) .setCommunications(localRouter), - new InetSocketAddress(0), commsDirectory, ffParams, + EndpointProvider.allocatePort(), commsDirectory, ffParams, IdentifierSpecification.newBuilder(), null); domains.add(domain); localRouter.start(); diff --git a/model/src/test/java/com/salesforce/apollo/model/DomainTest.java b/model/src/test/java/com/salesforce/apollo/model/DomainTest.java index 3450e04c7..06ec38cb5 100644 --- a/model/src/test/java/com/salesforce/apollo/model/DomainTest.java +++ b/model/src/test/java/com/salesforce/apollo/model/DomainTest.java @@ -6,6 +6,7 @@ */ package com.salesforce.apollo.model; +import com.salesforce.apollo.archipelago.EndpointProvider; import com.salesforce.apollo.archipelago.LocalServer; import com.salesforce.apollo.archipelago.Router; import com.salesforce.apollo.archipelago.ServerConnectionCache; @@ -30,7 +31,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.net.InetSocketAddress; import java.nio.file.Path; import java.security.SecureRandom; import java.time.Duration; @@ -228,7 +228,7 @@ public void before() throws Exception { context) .setCommunications( localRouter), - new InetSocketAddress(0), ffParams, null); + EndpointProvider.allocatePort(), ffParams, null); domains.add(domain); localRouter.start(); }); diff --git a/model/src/test/java/com/salesforce/apollo/model/FireFliesTest.java b/model/src/test/java/com/salesforce/apollo/model/FireFliesTest.java index f492fa0e0..cb9b466d1 100644 --- a/model/src/test/java/com/salesforce/apollo/model/FireFliesTest.java +++ b/model/src/test/java/com/salesforce/apollo/model/FireFliesTest.java @@ -6,6 +6,7 @@ */ package com.salesforce.apollo.model; +import com.salesforce.apollo.archipelago.EndpointProvider; import com.salesforce.apollo.archipelago.LocalServer; import com.salesforce.apollo.archipelago.Router; import com.salesforce.apollo.archipelago.ServerConnectionCache; @@ -31,7 +32,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.net.InetSocketAddress; import java.nio.file.Path; import java.security.SecureRandom; import java.time.Duration; @@ -96,7 +96,7 @@ public void before() throws Exception { .setContext(context) .setCommunications( localRouter), - new InetSocketAddress(0), ffParams, null); + EndpointProvider.allocatePort(), ffParams, null); domains.add(node); routers.put(node, localRouter); localRouter.start(); @@ -109,7 +109,7 @@ public void smokin() throws Exception { long then = System.currentTimeMillis(); final var countdown = new CountDownLatch(domains.size()); final var seeds = Collections.singletonList( - new Seed(domains.getFirst().getMember().getIdentifier().getIdentifier(), new InetSocketAddress(0))); + new Seed(domains.getFirst().getMember().getIdentifier().getIdentifier(), EndpointProvider.allocatePort())); domains.forEach(d -> { BiConsumer c = (context, viewId) -> { if (context.cardinality() == CARDINALITY) {