WmsHelper { public static String getCapabilities(String wmsURL) throws IOException { InputStream is = null; try { is = HTTPUtils.sendPacket( new URL(wmsURL + "?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities"), "GET"); String result = HTTPUtils.getStringFromInputStream(is); return result; } finally { if (is != null) is.close(); } }  static String getCapabilities(String wmsURL);  }
@Test public void getCapabilitiesWithBogusURL() throws Exception { String result = null; try { result = WmsHelper.getCapabilities("https: } catch (IOException ex) { assertThat(ex, is(instanceOf(UnknownHostException.class))); } assertThat(result, is(nullValue())); }