### Question:
CelleryHostnameVerifier implements HostnameVerifier { @Override public boolean verify(String host, SSLSession sslSession) { if (!verifyHostname) { return true; } if (containsHost(host, LOCALHOSTS) || containsHost(host, CELLERY_HOSTS)) { return true; } return hostnameVerifier.verify(host, sslSession); } CelleryHostnameVerifier(HostnameVerifier hostnameVerifier); @Override boolean verify(String host, SSLSession sslSession);  }### Answer:
@Test(dataProvider = "validHostnameDataProvider") public void testVerifyEnablingHNV(String hostname) throws Exception { try { System.setProperty(HOSTNAME_VERIFICATION_ENABLED, "true"); celleryHostnameVerifier = new CelleryHostnameVerifier(defaultHostnameVerifier); Assert.assertTrue(celleryHostnameVerifier.verify(hostname, null)); } finally { System.getProperties().remove(HOSTNAME_VERIFICATION_ENABLED); } }
@Test(dataProvider = "invalidHostnameDataProvider") public void testVerifyPassEnablingHNV(String hostname) throws Exception { try { System.setProperty(HOSTNAME_VERIFICATION_ENABLED, "true"); celleryHostnameVerifier = new CelleryHostnameVerifier(defaultHostnameVerifier); Assert.assertFalse(celleryHostnameVerifier.verify(hostname, null)); } finally { System.getProperties().remove(HOSTNAME_VERIFICATION_ENABLED); } }
@Test(dataProvider = "validHostnameDataProvider") public void testVerifyWithoutEnablingHNV(String hostname) throws Exception { celleryHostnameVerifier = new CelleryHostnameVerifier(defaultHostnameVerifier); Assert.assertTrue(celleryHostnameVerifier.verify(hostname, null)); }
@Test(dataProvider = "invalidHostnameDataProvider") public void testVerifyPassWithoutEnablingHNV(String hostname) throws Exception { celleryHostnameVerifier = new CelleryHostnameVerifier(defaultHostnameVerifier); Assert.assertTrue(celleryHostnameVerifier.verify(hostname, null)); }