### Question:
LocalApiServer { public void start() throws Exception { final SslContext sslCtx; if (SSL) { SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).build(); } else { sslCtx = null; } try{ ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .childHandler(new LocalApiServerPipelineFactory(sslCtx)); Channel ch = b.bind(PORT).sync().channel(); LoggingService.logDebug(MODULE_NAME, "Local api server started at port: " + PORT + "\n"); ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(new ControlWebsocketWorker(), 10, 10, TimeUnit.SECONDS); scheduler.scheduleAtFixedRate(new MessageWebsocketWorker(), 10, 10, TimeUnit.SECONDS); ch.closeFuture().sync(); }finally{ bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }  void start();  }### Answer:
@Test public void testStart() { try { localApiServer.start(); Mockito.verify(serverBootstrap).childHandler(Mockito.eq(localApiServerPipelineFactory)); Mockito.verify(serverBootstrap).channel(Mockito.eq(NioServerSocketChannel.class)); Mockito.verify(serverBootstrap).bind(Mockito.eq(54321)); Mockito.verify(channel).closeFuture(); Mockito.verify(channelFuture).channel(); Mockito.verify(channelFuture, Mockito.atLeastOnce()).sync(); } catch (Exception e) { fail("This should not happen"); } }