@Test public void serverDoesNotStartUntilPluginsAreStarted() throws InterruptedException { CountDownLatch latch = new CountDownLatch(1); StyxServer styxServer = styxServerWithPlugins(ImmutableMap.of( "slowlyStartingPlugin", new Plugin() { @Override public void styxStarting() { try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } } @Override public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request1, Chain chain) { return Eventual.of(response(OK).build()); } } )); try { styxServer.startAsync(); Thread.sleep(10); assertThat(styxServer.proxyHttpAddress(), nullValue()); latch.countDown(); eventually(() -> assertThat(styxServer.proxyHttpAddress().getPort(), is(greaterThan(0)))); } finally { stopIfRunning(styxServer); } }
public InetSocketAddress proxyHttpAddress() { return Optional.ofNullable(httpServer) .map(InetServer::inetAddress) .orElse(null); }
StyxServer extends AbstractService { public InetSocketAddress proxyHttpAddress() { return Optional.ofNullable(httpServer) .map(InetServer::inetAddress) .orElse(null); } }
StyxServer extends AbstractService { public InetSocketAddress proxyHttpAddress() { return Optional.ofNullable(httpServer) .map(InetServer::inetAddress) .orElse(null); } StyxServer(StyxServerComponents config);  StyxServer(StyxServerComponents components, Stopwatch stopwatch); }
StyxServer extends AbstractService { public InetSocketAddress proxyHttpAddress() { return Optional.ofNullable(httpServer) .map(InetServer::inetAddress) .orElse(null); } StyxServer(StyxServerComponents config);  StyxServer(StyxServerComponents components, Stopwatch stopwatch); static void main(String[] args); InetSocketAddress serverAddress(String name); InetSocketAddress proxyHttpAddress(); InetSocketAddress proxyHttpsAddress(); InetSocketAddress adminHttpAddress(); }
StyxServer extends AbstractService { public InetSocketAddress proxyHttpAddress() { return Optional.ofNullable(httpServer) .map(InetServer::inetAddress) .orElse(null); } StyxServer(StyxServerComponents config);  StyxServer(StyxServerComponents components, Stopwatch stopwatch); static void main(String[] args); InetSocketAddress serverAddress(String name); InetSocketAddress proxyHttpAddress(); InetSocketAddress proxyHttpsAddress(); InetSocketAddress adminHttpAddress();  }