Implemented and tested the method to stop the server.