WFLY-3505 Check if service is up before using, to work around problem.

This is of https://github.com/wildfly/wildfly/pull/6426 moved to wildfly-core. See the discussion there.