public void stopServer() {
		logger.fine("Stopping server...");
		boolean wasRunning = false;
		synchronized(CONNECTION_LOCK) {
			wasRunning = isRunning;
			if(isRunning) {
				logger.finer("Sending disconnect packets to all clients");
				for(Integer clientId : clients.keySet()) {
					ClientInfo client = clients.get(clientId);
					try {
						sendPacket(Packet.createForceDisconnectPacket(clientId, Server.SERVER_STOPPING), client);
					} catch (CouldNotSendPacketException e) {
						//no need to report that we couldn't ask the client to disconnect--the server is stopping regardless
					}
					//no need to call onClientDisconnected--the server is stopping, of course all the clients are going to be disconnected
				}
			}
			closeConnection();
		}
		if(wasRunning)
			onServerStopped();
		logger.fine("Server stopped");
	}