Below is example code
XML for setting parameters
Right Click on XML and run it as TestNG Test. Below is output in console window
Extending this example and adding multiple tests and setting it for parallel execution and preserve test order.
Modified XML File
Modified code adding try-catch block (Keeping up with Coding Guidelines :))