@@ -0,0 +1,1151 @@
+package org.webbitserver.netty;%0A%0Aimport java.util.Set;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A *%0A * @author Kushal Pisavadia%0A */%0Apublic class NettyWebServerTest %7B%0A%0A    /**%0A     * Tests the stop() method in NettyWebServer. Makes sure that we are stopping%0A     * the web server cleanly and not leaving any resources hanging.%0A     *%0A     * @throws Exception%0A     * @see NettyWebServer%0A     */%0A    @Test%0A    public void testStop() throws Exception %7B%0A        int threadCountStart = 0, threadCountEnd = 0;%0A%0A        threadCountStart = this.getCurrentThreadCount();%0A%0A        // Build, start, wait and stop the Netty Web Server%0A        NettyWebServer instance = new NettyWebServer(8080).start();%0A        Thread.sleep(1000); // sleep for 1 second%0A        instance.stop();%0A%0A        threadCountEnd = this.getCurrentThreadCount();%0A%0A        assertEquals(threadCountStart, threadCountEnd);%0A    %7D%0A%0A    private int getCurrentThreadCount() %7B%0A        Set%3CThread%3E threadSet = Thread.getAllStackTraces().keySet();%0A        Thread%5B%5D threadArray = threadSet.toArray(new Thread%5BthreadSet.size()%5D);%0A        return threadArray.length;%0A    %7D%0A%0A%7D

Add a test for .stop() on NettyWebServer to make sure that all resources have been released cleanly