private ConnectionToClient findOpponent( ConnectionToClient client) throws NullPointerException
  {
	Long opponentId = -1L; // Default value for a long
	
	ClientNode clientNode = new ClientNode(-999L);;
	
	for( ClientNode node : clientList )
	{// Iterate through all clients connected in the list
		
		// If listClient different from clientConnected and that client has himself as opponent
		if( node.getPlayerID() == client.getId())
		{
			clientNode = node; // find client node
	    	break;
		}
	}
	if (clientNode.getOpponentID() == clientNode.getPlayerID())
	{
    	for( ClientNode possibleOpponentNode : clientList )
    	{// Iterate through all clients connected in the list
    		
    		// If listClient different from clientConnected and that client has himself as opponent
    		if( possibleOpponentNode.getPlayerID() != clientNode.getPlayerID() && possibleOpponentNode.getPlayerID() == possibleOpponentNode.getOpponentID())
    		{
    			// Sets the client's opponent's opponent as himself
    			opponentId = possibleOpponentNode.getPlayerID();
    			possibleOpponentNode.setOpponentID(client.getId());
    			clientNode.setOpponentID(opponentId);
    	    	break;
    		}
    	}
	}
	else
		opponentId = clientNode.getOpponentID();
	
	// Iterate through the connectiontoclients array
	if(opponentId != -1L)
	{
		for(Thread clientThread : getClientConnections())// list of connections
		{
			if(clientThread.getId() == opponentId)
			{
				return (ConnectionToClient) clientThread;
			}
		}
	}
	else
		throw new NullPointerException("Client has no opponent.");
	
	return null;
  }