List of usage examples for io.netty.handler.logging LogLevel INFO
LogLevel INFO
To view the source code for io.netty.handler.logging LogLevel INFO.
Click Source Link
From source file:org.wso2.carbon.inbound.endpoint.protocol.http2.management.Http2EndpointManager.java
License:Open Source License
public boolean startSSLListener(int port, String name, InboundProcessorParams params) { if (org.wso2.carbon.inbound.endpoint.protocol.websocket.management.WebsocketEventExecutorManager .getInstance().isRegisteredExecutor(port)) { log.info("Netty Listener already started on port " + port); return true; }//w w w .ja v a2 s . co m InboundHttp2Configuration config = buildConfiguration(port, name, params); InboundWebsocketSSLConfiguration SslConfig = buildSSLConfiguration(params); if (config.isEnableServerPush()) { if (config.getDispatchSequence() == null || config.getErrorSequence() == null) { throw new SynapseException("dispatch.outflow.sequence and error.outflow.sequence " + "cannot be empty if server-push enabled"); } } NettyThreadPoolConfiguration threadPoolConfig = new NettyThreadPoolConfiguration( config.getBossThreadPoolSize(), config.getWorkerThreadPoolSize()); InboundHttp2EventExecutor eventExecutor = new InboundHttp2EventExecutor(threadPoolConfig); org.wso2.carbon.inbound.endpoint.protocol.http2.management.Http2EventExecutorManager.getInstance() .registerEventExecutor(port, eventExecutor); try { ServerBootstrap b = new ServerBootstrap(); b.option(ChannelOption.SO_BACKLOG, 1024); b.group(eventExecutor.getBossGroupThreadPool(), eventExecutor.getWorkerGroupThreadPool()) .channel(NioServerSocketChannel.class).handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new InboundHttp2ServerInitializer(getSSLContext(SslConfig), config)); b.bind(config.getPort()).sync().channel(); log.info("Http2-secure Inbound started on Port : " + config.getPort()); } catch (InterruptedException e) { log.error(e.getMessage(), e); } return true; }
From source file:org.wso2.carbon.mss.internal.router.NettyHttpService.java
License:Open Source License
/** * Bootstrap the pipeline./*from w ww . j a va 2 s. c o m*/ * <ul> * <li>Create Execution handler</li> * <li>Setup Http resource handler</li> * <li>Setup the netty pipeline</li> * </ul> * * @param eventExecutor Executor group */ private void bootStrap(final DefaultEventExecutorGroup eventExecutor) throws Exception { NioEventLoopGroup bossGroup = new NioEventLoopGroup(bossThreadPoolSize, new ThreadFactoryBuilder().setDaemon(true).setNameFormat("netty-boss-thread").build()); NioEventLoopGroup workerGroup = new NioEventLoopGroup(workerThreadPoolSize, new ThreadFactoryBuilder().setDaemon(true).setNameFormat("netty-worker-thread").build()); //Server bootstrap with default worker threads (2 * number of cores) bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup); bootstrap.channel(NioServerSocketChannel.class); bootstrap.handler(new LoggingHandler(LogLevel.INFO)); for (Map.Entry<ChannelOption, Object> entry : channelConfigs.entrySet()) { bootstrap.option(entry.getKey(), entry.getValue()); } resourceHandler.init(handlerContext); //TODO: Check how to handle this /*final ChannelInboundHandlerAdapter connectionTracker = new ChannelInboundHandlerAdapter() { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { channelGroup.add(ctx.channel()); super.channelActive(ctx); } };*/ bootstrap.childHandler(new ServerInitializer(eventExecutor, httpChunkLimit, sslHandlerFactory, resourceHandler, pipelineModifier)); }
From source file:org.wso2.esb.integration.common.utils.servers.Http2Server.java
License:Open Source License
public void startServer() throws Exception { final SslContext sslCtx; if (SSL) {//from www. j av a 2 s . c om SslProvider provider = OpenSsl.isAlpnSupported() ? SslProvider.OPENSSL : SslProvider.JDK; SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).sslProvider(provider) .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE) .applicationProtocolConfig(new ApplicationProtocolConfig(Protocol.ALPN, SelectorFailureBehavior.NO_ADVERTISE, SelectedListenerFailureBehavior.ACCEPT, ApplicationProtocolNames.HTTP_2, ApplicationProtocolNames.HTTP_1_1)) .build(); } else { sslCtx = null; } group = new NioEventLoopGroup(); ServerBootstrap b = new ServerBootstrap(); b.option(ChannelOption.SO_BACKLOG, 1024); b.group(group).channel(NioServerSocketChannel.class).handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new Http2ServerInitializer(sslCtx)); b.bind("127.0.0.5", PORT).sync().channel(); }
From source file:org.wso2.test.http.netty.proxy.DelayingProxy.java
License:Open Source License
public void initialize(ProxyConfig proxyConfig) { proxyConfigurator = new ProxyConfiguratorImpl(proxyConfig); // Configure the bootstrap. bossGroup = new NioEventLoopGroup(1); workerGroup = new NioEventLoopGroup(); List<Channel> serverChannels = new ArrayList<Channel>(); ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10); try {/*from w w w . j a v a 2s. co m*/ for (ProxyConfigEntry proxyConfigEntry : proxyConfig.getProxyConfigs()) { ServerBootstrap b = new ServerBootstrap(); Channel c = b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new DelayingProxyInitializer(proxyConfigEntry, scheduledExecutorService)) .childOption(ChannelOption.AUTO_READ, false).bind(proxyConfigEntry.getInboundPort()).sync() .channel(); serverChannels.add(c); } } catch (InterruptedException e) { //Ignore for now } }
From source file:org.wyb.smtp.mosmtp.SmtpServer.java
License:Apache License
public static void main(String[] args) throws Exception { // Configure SSL. final SslContext sslCtx; if (SSL) {// w w w . j a v a2 s . c o m SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).build(); } else { sslCtx = null; } EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new SmtpServerInitializer(sslCtx, new DummyMessageHandler())); b.bind(PORT).sync().channel().closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }
From source file:org.wyb.sows.server.WebSocketServer.java
License:Apache License
public static void main(String[] args) throws Exception { PropertyConfigurator.configure("./config/serverlog.config"); // Configure SSL. final SslContext sslCtx; if (SSL) {//from w ww .j av a2 s . c om SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).build(); } else { sslCtx = null; } EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)).option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000) .option(ChannelOption.SO_KEEPALIVE, true) .childHandler(new WebSocketServerInitializer(sslCtx, new SimpleAuthHandler())); Channel ch = b.bind(PORT).sync().channel(); logger.info("WebSocketServer is started."); ch.closeFuture().sync(); logger.info("WebSocketServer is closed."); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); logger.info("EventLoopGroups are shutdown."); } }
From source file:org.xwiki.contrib.websocket.internal.NettyWebSocketService.java
License:Open Source License
private void initialize0() throws Exception { final SslContext sslCtx; if (this.conf.sslEnabled()) { if (this.conf.getCertChainFilename() != null) { // They provided a cert chain filename (and ostensibly a private key) // ssl w/ CA signed certificate. final File certChain = new File(this.conf.getCertChainFilename()); final File privKey = new File(this.conf.getPrivateKeyFilename()); checkCertChainAndPrivKey(certChain, privKey); sslCtx = SslContext.newServerContext(certChain, privKey); } else {/*from w ww . ja v a2 s. co m*/ // SSL enabled but no certificate specified, lets use a selfie this.logger.warn("websocket.ssl.enable = true but websocket.ssl.certChainFile " + "is unspecified, generating a Self Signed Certificate."); SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContext.newServerContext(ssc.certificate(), ssc.privateKey()); } } else { sslCtx = null; } final EventLoopGroup bossGroup = new NioEventLoopGroup(1); final EventLoopGroup workerGroup = new NioEventLoopGroup(); ServerBootstrap b = new ServerBootstrap(); // get rid of silly lag b.childOption(ChannelOption.TCP_NODELAY, Boolean.TRUE); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new WebSocketServerInitializer(sslCtx, this)); Channel ch = b.bind(this.conf.getBindTo(), this.conf.getPort()).sync().channel(); ch.closeFuture().addListener(new GenericFutureListener<ChannelFuture>() { public void operationComplete(ChannelFuture f) { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }); }
From source file:ozy.server.Server.java
License:Open Source License
final void run() throws Exception { System.out.println("[Server] bootstrapping"); ServerBootstrap b = new ServerBootstrap(); b.group(_bossGroup, _workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)).childHandler(new ServerInitializer(this)); System.out.println("[Server] binding to port: " + port()); _channel = b.bind(port()).sync().channel(); System.out.println("[Server] running"); _channel.closeFuture().sync();// w w w. ja v a 2 s. co m System.out.println("[Server] ended"); }
From source file:proxy.mock.workstation.HttpDelayServer.java
License:Apache License
public static void main(String[] args) throws Exception { InprogressMessageQueue.getInstance().init(); // Configure the server. EventLoopGroup bossGroup = new NioEventLoopGroup(4); EventLoopGroup workerGroup = new NioEventLoopGroup(); try {//from w w w .j av a2 s .c om ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) { ChannelPipeline p = ch.pipeline(); p.addLast(new HttpServerCodec()); p.addLast(new HttpServerDelayHandler()); } }); Channel ch = b.bind(PORT).sync().channel(); System.err.println("Open your web browser and navigate to " + "http://127.0.0.1:" + PORT + '/'); ch.closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }
From source file:proxy.server.HttpServer.java
License:Apache License
public static void main(String[] args) throws Exception { final HttpBackendMgr httpBackendMgr = new HttpBackendMgr(); // Configure the server. EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); try {/* w ww .j a va2s . co m*/ ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new HttpServerCodec()); p.addLast(new HttpServerHandler(httpBackendMgr)); } }); Channel ch = b.bind(PORT).sync().channel(); System.err.println("Open your web browser and navigate to " + "http://127.0.0.1:" + PORT + '/'); ch.closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }