adamfisk / LittleProxy

High performance HTTP proxy originally written by your friends at Lantern and now maintained by a stellar group of volunteer open source programmers.

Home Page:https://www.getlantern.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shutdown takes 2 seconds

bwaldvogel opened this issue · comments

Shutdown of a default proxy server takes about two seconds on my machine.

public class StartStopTest {
    @Test
    public void testStartStop() {
        HttpProxyServer server = DefaultHttpProxyServer.bootstrap()
            .withPort(0)
            .start();
        server.stop();
    }
}

Log output:

[…]
21:47:49.518 [main] INFO DefaultHttpProxyServer - Proxy started at address: /127.0.0.1:41593
21:47:49.518 [main] INFO DefaultHttpProxyServer - Shutting down proxy server gracefully
21:47:49.518 [main] INFO DefaultHttpProxyServer - Closing all channels (graceful)
21:47:49.523 [main] DEBUG ServerGroup - Proxy server unregistered from ServerGroup. No proxy servers remain registered, so shutting down ServerGroup.
21:47:49.523 [main] INFO ServerGroup - Shutting down server group event loops (graceful)
21:47:51.782 [main] DEBUG ServerGroup - Done shutting down server group
21:47:51.782 [main] INFO DefaultHttpProxyServer - Done shutting down proxy server

Note the gap between 21:47:49.523 and 21:47:51.782.

The delay of two seconds might sound irrelevant but it sums up if a proxy server is started and stop several times during a test suite.