EDIT: Updated description and error message and added some images. Still have this problem.
I have a strange error that occur many times when running espresso tests. Af
Mainly the error is because if your connection is not in an active mode, it shouldn't be in sleep mode either it has to be in the app where the test cases have been written. Assuming you already used the @Rule Activity launch rule.