Here is a simple method to check if a server is listening on a certain port. I used it to ignore certain non-critical SFTP related integration tests in a project when I hadn’t bothered starting the SFTP server.
To ignore a test (assuming JUnit) you can then do the following:
public void some_test()
// Rest of test...