Esempio n. 1
0
 private static HttpServer startUpServerWith(
     String portString, int numberOfWorkers, Module... modules) {
   int port = Integer.parseInt(portString);
   Injector injector = Guice.createInjector(modules);
   HttpServer server = injector.getInstance(HttpServer.class);
   server.setNumberOfWorkers(numberOfWorkers);
   server.init(injector, port);
   server.startUp();
   return server;
 }
Esempio n. 2
0
 private static void startTrafficServer(
     Properties trafficProperties, Module managerModule, Module proxyServerModule) {
   trafficProperties.put(
       ClassNamesResourceConfig.PROPERTY_CLASSNAMES,
       TrafficResource.class.getName() + " " + AdminUIResource.class.getName());
   String trafficPort = trafficProperties.getProperty(TRAFFIC_PORT);
   startUpServerWith(
       trafficPort,
       HttpServer.createPropertiesModule(trafficProperties),
       managerModule,
       proxyServerModule,
       new TrafficModule());
 }
Esempio n. 3
0
 private static HttpServer startProxyServer(Properties proxyProperties, Module managerModule) {
   proxyProperties.put(
       ClassNamesResourceConfig.PROPERTY_CLASSNAMES, ProxyResource.class.getName());
   proxyProperties.put(
       ClassNamesResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, ProxyFilter.class.getName());
   String proxyPort = proxyProperties.getProperty(PROXY_PORT);
   String numberOfWorkers = proxyProperties.getProperty(PROXY_WORKERS);
   proxyProperties.put(
       NettyHandlerContainer.PROPERTY_BASE_URI,
       "http://" + proxyProperties.getProperty(PROXY_HOST) + ":" + proxyPort + "/");
   return startUpServerWith(
       proxyPort,
       (StringUtils.isNotBlank(numberOfWorkers)
           ? Integer.parseInt(numberOfWorkers)
           : DEFAULT_NUMBER_OF_WORKERS),
       HttpServer.createPropertiesModule(proxyProperties),
       managerModule,
       new ProxyModule());
 }