I am writing some java code to test an ios native app using Cucumber/Gherkin BDD. I have 2 devices in a single test, sender and rcvr. Because the login process is time consuming, I use java 8 parallel stream for user login into the aforementioned devices. Occassionally, 1 of the 2 logins fails. When a login fails, an Assertion is thrown on the thread running the login process. I am noticing that the test does not always stop when the Assertion in thrown. My hypothesis is the test keeps trying to run until the device with failed "login" is suppose to do something, because the Assertion may be on a thread different than Cucumber/Testng.
Is there a way to propagate the exception/error from the parallel stream to the thread the initiated the parallel stream ?? Or, must all login validation occur on the "master thread".