test if the connection can be established with the given host and port