The REST API is only needed until a valid flatfile is received. Afterwards, the flatfile is handed over to
H2O via embedded config. Therefore, as soon as the embedded config is constructed, the REST API is shut down
and the objects destroyed. However, there might still be a thread running - sending HTTP response to the assist which
sent the flatfile. The
NanoHTTPD.DefaultAsyncRunner does not wait for existing connections
to be properly terminated and shuts them down.
This implementation overrides that behavior and waits until all connections are closed before shutdown.