public void stop() {
        try {
            safeClose(myServerSocket);
            closeAllConnections();
            if (myThread != null) {
                myThread.join();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }