Source:
<code>public void testHTTPListenerAfterRejoin() throws Exception { if (!VoltDB.instance().getConfig().m_isEnterprise) { return; } VoltProjectBuilder builder = new VoltProjectBuilder(); builder.setSecurityEnabled(false, false); builder.setHTTPDPort(0); builder.setJSONAPIEnabled(true); LocalCluster cluster = new LocalCluster("rejoin.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI, true); try { boolean success = cluster.compile(builder); assertTrue(success); cluster.startUp(); String url = "<LINK_0>" + cluster.httpPort(0) + "/deployment"; try { getUrlOverJSON(url, null, null, null, 200, "application/json"); } catch (HttpHostConnectException e) { fail("HTTP Listener is not open when the node is on"); } cluster.killSingleHost(0); Thread.sleep(1000); url = "<LINK_0>" + cluster.httpPort(0) + "/deployment"; try { getUrlOverJSON(url, null, null, null, 200, "application/json"); fail("HTTP Listener is not closed when the node is down."); } catch (HttpHostConnectException e) { assertTrue(e.toString().contains("Connection refused")); } cluster.recoverOne(0, 0, "", true); Thread.sleep(1000); url = "<LINK_0>" + cluster.httpPort(2) + "/deployment"; try { getUrlOverJSON(url, null, null, null, 200, "application/json"); } catch (HttpHostConnectException e) { fail("HTTP Listener is not open after the node has rejoined."); } } catch (Exception e) { <START> e.printStackTrace(); <END> } finally { cluster.shutDown(); } }</code><technical_language>This correct. If fail() throws AssertionError, get a stack trace test pass. OK declare test method "throws Exception" - this result in uncaught exception propagating JUnit failing test</technical_language>

Target:
public void testHTTPListenerAfterRejoin() throws Exception { if (!VoltDB.instance().getConfig().m_isEnterprise) { return; } final long TIMEOUT_THRESHOLD = 60000; VoltProjectBuilder builder = new VoltProjectBuilder(); builder.setSecurityEnabled(false, false); builder.setJSONAPIEnabled(true); LocalCluster cluster = new LocalCluster("rejoin.jar", 2, 3, 1, BackendTarget.NATIVE_EE_JNI, true); try { boolean success = cluster.compile(builder); assertTrue(success); cluster.setHttpPortEnabled(true); cluster.startUp(); long startTime = System.currentTimeMillis(); int port0 = cluster.httpPort(0), port1 = cluster.httpPort(1), port2 = cluster.httpPort(2); while ( !canAccessHttpPort(port0)|| !canAccessHttpPort(port1) || !canAccessHttpPort(port2)) { if (System.currentTimeMillis() - startTime >= TIMEOUT_THRESHOLD) { fail("Local cluster failed to start up"); } Thread.sleep(200); } assertTrue("Http port failed to open when the node is on", canAccessHttpPort(port0)); cluster.killSingleHost(0); assertFalse("Http port failed to close when the node is offline", canAccessHttpPort(port0)); cluster.recoverOne(0, 0, "", true); startTime = System.currentTimeMillis(); port0 = cluster.httpPort(3); while ( !canAccessHttpPort(port0)|| !canAccessHttpPort(port1) || !canAccessHttpPort(port2)) { if (System.currentTimeMillis() - startTime >= TIMEOUT_THRESHOLD) { fail("Local cluster failed to rejoin"); } Thread.sleep(200); } assertTrue("Http port failed to open when the node is rejoined", canAccessHttpPort(port0)); Thread.sleep(1000); } finally { try {cluster.shutDown();} catch (Exception e) } }