Fix java.lang.IllegalStateException: UiAutomationService not connected.

Fixes #675
Merge pull request #703 from bootstraponline/675

Fix java.lang.IllegalStateException: UiAutomationService not connected.