How can i wait to appium server before test start

Appium Desktop 1.2.0-beta.3
Appium server 1.6.5
java-client 5.0.2

Hi
Yesturday I updateed java-cleint to 5.0.2. Now when I starts test programmatically, the tests scenario start before appium server starts. I have in log[31mFailure in before hook:e[0me[31mCheckScreensSteps.setUpAppium()e[0m
06:43:26 e[31mMessage: e[0me[31morg.openqa.selenium.WebDriverException: Connection refused (Connection refused)

How can i wait to appium server before test start?

@CrashTestDummy pls add code how you start appium server :slight_smile:

I had to handle the WebDriverException, it is works now. Thenks