Starts the server, calls afterStart.
Starts the server, calls afterStart. then waits. The waiting behavior depends on whether the current thread is "main"; if not "main" it assumes this is an interactive session with sbt and waits for any input, then calls stop(), afterStop(...), and finally destroy(). If the current thread is "main", it waits indefinitely and performs stop() and afterStop(...) in a shutdown hook.
Starts the server then takes an action
Calls run with no afterStart or afterStop functions