private void startClient() throws Exception { SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setEndpointIdentificationAlgorithm(""); sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks"); sslContextFactory.setKeyStorePassword("storepwd"); sslContextFactory.setTrustStorePath("src/test/resources/truststore.jks"); sslContextFactory.setTrustStorePassword("storepwd"); QueuedThreadPool clientThreads = new QueuedThreadPool(); clientThreads.setName("client"); client = new HttpClient(new HttpClientTransportOverHTTP(1), sslContextFactory); client.setExecutor(clientThreads); client.start(); }
public void start(Handler handler) throws Exception { if (sslContextFactory != null) { sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks"); sslContextFactory.setKeyStorePassword("storepwd"); sslContextFactory.setTrustStorePath("src/test/resources/truststore.jks"); sslContextFactory.setTrustStorePassword("storepwd"); } if (server == null) server = new Server(); connector = new ServerConnector(server, sslContextFactory); server.addConnector(connector); server.setHandler(handler); server.start(); QueuedThreadPool executor = new QueuedThreadPool(); executor.setName(executor.getName() + "-client"); client = new HttpClient(sslContextFactory); client.setExecutor(executor); client.start(); }