@Test public void testStart() throws Exception { String projectDir = System.getProperty("projectDir"); String resources = new File(projectDir+"/src/test/resources").getPath(); File fileDir = new File(projectDir+"/build/files-2"); if(fileDir.mkdirs()) System.out.println("Created "+fileDir.getPath()); Jetty jetty = new Jetty().setRoots(resources).setPutDir(fileDir.getPath()); jetty.startSecure(); int count = 5; CyclicBarrier gate = new CyclicBarrier(count+1); CountDownLatch filesWritten = new CountDownLatch(count); List<Fetcher> fetchers = new ArrayList<>(); for (int i = 0; i < count; i++) { String file = String.format("file%s.txt", (i % 2 == 0 ? 1 : 2)); String fileURL = String.format("%s%s", jetty.getURI().toASCIIString(), file); Fetcher fetcher = new Fetcher(gate, new URL(fileURL), fileDir, filesWritten, i); fetchers.add(fetcher); new Thread(fetcher).start(); } gate.await(); filesWritten.await(); int totalFailed = 0; for (Fetcher f : fetchers) { if (f.failed > 0) { totalFailed++; System.out.println("Fetcher ["+f.index+"] failed "+f.failed+" time(s)"); } } System.out.println("Total failed Fetchers: "+totalFailed); }
@Override public void start() throws Exception { createServer(); ServerConnector connector = new ServerConnector(server); connector.setPort(port); String address = HostUtil.getHostAddressFromProperty("java.rmi.server.hostname"); connector.setHost(address); server.setConnectors(new Connector[] { connector }); server.setHandler(handlers); server.start(); setProperty(); }
Jetty implements WebsterService { @Override public void start() throws Exception { createServer(); ServerConnector connector = new ServerConnector(server); connector.setPort(port); String address = HostUtil.getHostAddressFromProperty("java.rmi.server.hostname"); connector.setHost(address); server.setConnectors(new Connector[] { connector }); server.setHandler(handlers); server.start(); setProperty(); } }
Jetty implements WebsterService { @Override public void start() throws Exception { createServer(); ServerConnector connector = new ServerConnector(server); connector.setPort(port); String address = HostUtil.getHostAddressFromProperty("java.rmi.server.hostname"); connector.setHost(address); server.setConnectors(new Connector[] { connector }); server.setHandler(handlers); server.start(); setProperty(); } Jetty();  Jetty(File jettyConfig);  Jetty(Configuration config); }
Jetty implements WebsterService { @Override public void start() throws Exception { createServer(); ServerConnector connector = new ServerConnector(server); connector.setPort(port); String address = HostUtil.getHostAddressFromProperty("java.rmi.server.hostname"); connector.setHost(address); server.setConnectors(new Connector[] { connector }); server.setHandler(handlers); server.start(); setProperty(); } Jetty();  Jetty(File jettyConfig);  Jetty(Configuration config); Jetty setRoots(String... roots); Jetty setPort(int port); Jetty setMinThreads(int minThreads); Jetty setMaxThreads(int maxThreads); Jetty setPutDir(String putDir); @Override void start(); @Override void startSecure(); @Override void terminate(); @Override URI getURI(); int getPort(); String getAddress(); void join(); static void main(String[] args); }
Jetty implements WebsterService { @Override public void start() throws Exception { createServer(); ServerConnector connector = new ServerConnector(server); connector.setPort(port); String address = HostUtil.getHostAddressFromProperty("java.rmi.server.hostname"); connector.setHost(address); server.setConnectors(new Connector[] { connector }); server.setHandler(handlers); server.start(); setProperty(); } Jetty();  Jetty(File jettyConfig);  Jetty(Configuration config); Jetty setRoots(String... roots); Jetty setPort(int port); Jetty setMinThreads(int minThreads); Jetty setMaxThreads(int maxThreads); Jetty setPutDir(String putDir); @Override void start(); @Override void startSecure(); @Override void terminate(); @Override URI getURI(); int getPort(); String getAddress(); void join(); static void main(String[] args);  }