public static void main(String[] args) throws Throwable {
		ServerSocket serverSocket = null;
		int port = 10009;
		try {
			serverSocket = new ServerSocket(port);
		} catch (IOException e) {
			System.err.println("Le serveur ne peut écouter sur le port : " + port);
			System.exit(1);
		}

		Socket clientSocket = null;
		System.out.println("En attente de connexion...");

		try {

			clientSocket = serverSocket.accept();
		} catch (IOException e) {
			
			System.err.println("Acceptation du client à echoué.");
			System.exit(1);
		}

		System.out.println("La connexion est réussie.");
		System.out.println("En attente de requête client...");

		// Mise en place des I/O client-server
		BufferedReader in = new BufferedReader(new InputStreamReader(
				clientSocket.getInputStream()));
		PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
		
		String inputLine;
		Server server = new Server();
		LinkedList<String> res = new LinkedList<String>();
		
		
		
		while (!(inputLine = in.readLine()).equals(Application.END_APP)) {
			
			
			res = (LinkedList<String>) server.receiveReq(inputLine, in);
			
			System.out.println("fin du reçu");
			
			try {
				res = (LinkedList<String>) server.lancerMethode(server.getModel(), res, res.pop());
			} catch (InvocationTargetException e) { 
				  try { throw e.getCause(); }
				  catch(ApplicationException err) { res = Application.appError(err.msg()); }
				  
			}
			
			//LinkedList<String> ret = server.model.listNickNameByName("Julien");
			
			//ret.add(Application.END_APP);
			while(!res.isEmpty())
				out.println(res.pop());

			System.out.println("Fin envoie");
							
		}
			
		System.out.println("Fin.......................");
		out.close();
		in.close();
		clientSocket.close();
		serverSocket.close();
	}