예제 #1
0
 @Override
 public void listen(String host, int port, int backlog, TLSParams tls) {
   SSLContext ssl = null;
   if (tls != null) {
     try {
       ssl = makeSSLContext(tls);
     } catch (NoSuchAlgorithmException e) {
       throw new EvaluatorException(e.toString());
     } catch (KeyManagementException e) {
       throw new EvaluatorException(e.toString());
     }
   }
   log.debug("About to listen for HTTP on {}:{}", host, port);
   if (ssl != null) {
     log.debug("Using SSLContext " + ssl);
   }
   try {
     server = NettyFactory.get().createServer(port, host, backlog, makePipeline(tls, ssl));
     log.debug("Listening on port {}", port);
   } catch (ChannelException ce) {
     stub.onError(ce.getMessage());
     stub.onClose(null, null);
   }
 }
예제 #2
0
 @Override
 public void close() {
   log.debug("Closing HTTP server");
   server.close();
   stub.onClose(null, null);
 }