code: public void stop() {
          try {
              safeClose(myServerSocket);
              closeAllConnections();
              myThread.join();
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
docs: Stop the server.