stop() Doesn't Stop the AsyncHttpServer
Based on the JavaDocs, I had presumed that stop(), called on an AsyncHttpServer, would revert the listen() call and stop the server from listening on the port. That does not seem to the case.
This project demonstrates the problem: https://github.com/commonsguy/cw-omnibus/tree/master/Diagnostics/WebServer
There are two launcher activities for a debug build. One brings up a list of recent Stack Overflow android questions, using Picasso. The other starts a service that in turn starts an AsyncHttpServer, listening on port 4999. If you bring up the / page on that port, you get some stats from Picasso about the images that were downloaded. There is a link to a /stop page that calls stopSelf() on the service, and in onDestroy(), the service calls stop() on the AsyncHttpServer. I have confirmed that onDestroy() is called and stop() is called as expected. However, the AsyncHttpServer continues to listen on that port and serve pages until the app's process is terminated.
My apologies if stop() is not the correct way to stop an AsyncHttpServer.
Source: koush/AndroidAsync