I am testing html error codes for some RESTful and server side event services. We currently only have MOCK services, when I kill the services, or start/stop the service I am supposed to get the associated HTML error codes on the browser. The way I am thinking of testing this is using our existing test framework JAVA/testNG/Selenium Grid2/ + other stuff to programmatically kill and start these MOCK services and then do the necessary asserts to make sure all is well. We currently have shell scripts for these functions but not sure how to implement via Java code or hook into .sh script...
.sh script:
'#!/bin/bash
set -x
cd /mock_services/push
pkill -f mockserver || true'