@Test void start() throws Exception { final DssRestServer dssRestServer = new DssRestServer("127.0.0.1", 8181); dssRestServer .addDssService(new DssRestActorJsonService("test", "/hi", DssRestMethodType.GET) { @Override protected DssRestServiceResponse handlingRequest(DssRestServiceRequest request) { return null; } }) .addDssService(new DssRestActorFormDataService("test2", "/hello", DssRestMethodType.GET) { @Override protected DssRestServiceResponse handlingRequest(DssRestServiceRequest<HashMap<String, Object>> request) { return null; } }); stopDssRestServerAfterActivated(dssRestServer, 10 ,15); dssRestServer.start(); assertTrue(dssRestServer.isShutdown()); }
@Override public void start() throws InterruptedException { final DssRestChannelInitializer channelInitializer = dssRestChannelInitializer(); system = createActorSystem(channelInitializer); logger.info("Create actor system: {}", system); setExceptionHandler(); final EventLoopGroup bossGroup = new NioEventLoopGroup(); final EventLoopGroup workerGroup = new NioEventLoopGroup(); final ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup); final DssRestChannelProperty property = newDssRestChannelProperty(); try { final DssRestChannel dssRestChannel = new DssRestChannel(); channel = dssRestChannel.bind(bootstrap, property, channelInitializer); active.set(true); shutdown.set(false); channel.closeFuture().sync(); } finally { logger.info("Shut down worker and boss group gracefully"); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); shutdown.set(true); } }
DssRestServer implements DssServer<DssRestActorService> { @Override public void start() throws InterruptedException { final DssRestChannelInitializer channelInitializer = dssRestChannelInitializer(); system = createActorSystem(channelInitializer); logger.info("Create actor system: {}", system); setExceptionHandler(); final EventLoopGroup bossGroup = new NioEventLoopGroup(); final EventLoopGroup workerGroup = new NioEventLoopGroup(); final ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup); final DssRestChannelProperty property = newDssRestChannelProperty(); try { final DssRestChannel dssRestChannel = new DssRestChannel(); channel = dssRestChannel.bind(bootstrap, property, channelInitializer); active.set(true); shutdown.set(false); channel.closeFuture().sync(); } finally { logger.info("Shut down worker and boss group gracefully"); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); shutdown.set(true); } } }
DssRestServer implements DssServer<DssRestActorService> { @Override public void start() throws InterruptedException { final DssRestChannelInitializer channelInitializer = dssRestChannelInitializer(); system = createActorSystem(channelInitializer); logger.info("Create actor system: {}", system); setExceptionHandler(); final EventLoopGroup bossGroup = new NioEventLoopGroup(); final EventLoopGroup workerGroup = new NioEventLoopGroup(); final ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup); final DssRestChannelProperty property = newDssRestChannelProperty(); try { final DssRestChannel dssRestChannel = new DssRestChannel(); channel = dssRestChannel.bind(bootstrap, property, channelInitializer); active.set(true); shutdown.set(false); channel.closeFuture().sync(); } finally { logger.info("Shut down worker and boss group gracefully"); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); shutdown.set(true); } } DssRestServer(String host, int port);  DssRestServer(String host, int port, DssLogLevel dssLogLevel);  DssRestServer(String host, int port, DssLogLevel dssLogLevel, boolean ssl, SslContext sslContext); }
DssRestServer implements DssServer<DssRestActorService> { @Override public void start() throws InterruptedException { final DssRestChannelInitializer channelInitializer = dssRestChannelInitializer(); system = createActorSystem(channelInitializer); logger.info("Create actor system: {}", system); setExceptionHandler(); final EventLoopGroup bossGroup = new NioEventLoopGroup(); final EventLoopGroup workerGroup = new NioEventLoopGroup(); final ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup); final DssRestChannelProperty property = newDssRestChannelProperty(); try { final DssRestChannel dssRestChannel = new DssRestChannel(); channel = dssRestChannel.bind(bootstrap, property, channelInitializer); active.set(true); shutdown.set(false); channel.closeFuture().sync(); } finally { logger.info("Shut down worker and boss group gracefully"); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); shutdown.set(true); } } DssRestServer(String host, int port);  DssRestServer(String host, int port, DssLogLevel dssLogLevel);  DssRestServer(String host, int port, DssLogLevel dssLogLevel, boolean ssl, SslContext sslContext); @Deprecated @SuppressWarnings("unchecked") DssRestServer addDssRestService(DssRestActorService service); @Override void start(); @Override void stop(); @Override boolean isActivated(); @Override boolean isShutdown(); @Override DssServer<DssRestActorService> addDssService(DssRestActorService service); @Override DssServer<DssRestActorService> addExceptionHandler(DssExceptionHandler exceptionHandler); }
DssRestServer implements DssServer<DssRestActorService> { @Override public void start() throws InterruptedException { final DssRestChannelInitializer channelInitializer = dssRestChannelInitializer(); system = createActorSystem(channelInitializer); logger.info("Create actor system: {}", system); setExceptionHandler(); final EventLoopGroup bossGroup = new NioEventLoopGroup(); final EventLoopGroup workerGroup = new NioEventLoopGroup(); final ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup); final DssRestChannelProperty property = newDssRestChannelProperty(); try { final DssRestChannel dssRestChannel = new DssRestChannel(); channel = dssRestChannel.bind(bootstrap, property, channelInitializer); active.set(true); shutdown.set(false); channel.closeFuture().sync(); } finally { logger.info("Shut down worker and boss group gracefully"); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); shutdown.set(true); } } DssRestServer(String host, int port);  DssRestServer(String host, int port, DssLogLevel dssLogLevel);  DssRestServer(String host, int port, DssLogLevel dssLogLevel, boolean ssl, SslContext sslContext); @Deprecated @SuppressWarnings("unchecked") DssRestServer addDssRestService(DssRestActorService service); @Override void start(); @Override void stop(); @Override boolean isActivated(); @Override boolean isShutdown(); @Override DssServer<DssRestActorService> addDssService(DssRestActorService service); @Override DssServer<DssRestActorService> addExceptionHandler(DssExceptionHandler exceptionHandler);  }