@Override public void serverStarted(Server server) throws Exception { if (endpoint == null) { assert server.activePort().isPresent(); endpoint = Endpoint.of(server.defaultHostname(), server.activePort().get() .localAddress().getPort()); } client.start(); final String key = endpoint.host() + '_' + endpoint.port(); final byte[] value = nodeValueCodec.encode(endpoint); client.create() .creatingParentsIfNeeded() .withMode(CreateMode.EPHEMERAL) .forPath(zNodePath + '/' + key, value); }
@Override public void serverStarted(Server server) throws Exception { // Ensure that the following work will be done once. if (completed.compareAndSet(false, true)) { builder.setSchemeAndPortIfAbsent(server.activePort().get()); assert builder.scheme() != null; config = new SamlPortConfig(builder.scheme(), builder.port()); future.complete(config); } } }
private String newUrl(String scheme) { final int port = server.activePort().get().localAddress().getPort(); return scheme + "://127.0.0.1:" + port; }
private String newUrl(String scheme) { final int port = server.activePort().get().localAddress().getPort(); return scheme + "://127.0.0.1:" + port; }
@Before public void initClient() { if (client == null) { client = HttpClient.of("http://127.0.0.1:" + server.activePort().get().localAddress().getPort()); } }
@BeforeClass public static void beforeClass() { server = ServerFactory.of(0); server.start().join(); client = HttpClient.of("http://127.0.0.1:" + server.activePort().get().localAddress().getPort()); }
/** * Returns the primary port of the server. * * @return the primary {@link ServerPort} if the server is started. {@link Optional#empty()} otherwise. */ public Optional<ServerPort> activePort() { final Server server = this.server; return server != null ? server.activePort() : Optional.empty(); }
/** * Returns the primary port of the server. * * @return the primary {@link ServerPort} if the server is started. {@link Optional#empty()} otherwise. */ public Optional<ServerPort> activePort() { final Server server = this.server; return server != null ? server.activePort() : Optional.empty(); }
/** * Returns the primary port of the server. * * @return the primary {@link ServerPort} if the server is started. {@link Optional#empty()} otherwise. */ public Optional<ServerPort> activePort() { final Server server = this.server; return server != null ? server.activePort() : Optional.empty(); }
@Override public void serverStarted(Server server) throws Exception { // Ensure that the following work will be done once. if (completed.compareAndSet(false, true)) { builder.setSchemeAndPortIfAbsent(server.activePort().get()); assert builder.scheme() != null; config = new SamlPortConfig(builder.scheme(), builder.port()); future.complete(config); } } }