### Question:
CurrentClient { public boolean enableListener() { HttpPut put = new HttpPut(this.listenerUrl); return invokeListener(put); } private  CurrentClient(String host, int port, int socketTimeout); static CurrentClientBuilder builder(); ConnectionReport getConnections(); ConnectionReport getConnections(String ip); ConnectionReport getConnections(InetAddress address); ConnectionReport getConnection(String host, int port); ConnectionReport getConnection(InetSocketAddress address); ClosedConnectionReport closeConnections(CloseType closeType); ClosedConnectionReport closeConnections(CloseType closeType, String ip); ClosedConnectionReport closeConnections(CloseType closeType, InetAddress address); ClosedConnectionReport closeConnection(CloseType closeType, String host, int port); ClosedConnectionReport closeConnection(CloseType closeType, InetSocketAddress address); boolean enableListener(); boolean disableListener(); boolean disableListener(int after);  }### Answer:
@Test public void testEnableListener() { stubFor(put(urlEqualTo(listenerUrl)).willReturn(aResponse().withBody("{\n" + " \"changed\": true\n" + "}"))); boolean enabled = underTest.enableListener(); assertEquals(true, enabled); }
@Test public void testEnableListenerAlreadyEnabled() { stubFor(put(urlEqualTo(listenerUrl)).willReturn(aResponse().withBody("{\n" + " \"changed\": false\n" + "}"))); boolean enabled = underTest.enableListener(); assertEquals(false, enabled); }
@Test(expected = ListenerRequestFailed.class, timeout = 2500) public void testListenerServerHanging() { stubFor(put(urlEqualTo(listenerUrl)).willReturn(aResponse().withFixedDelay(5000))); lowTimeoutClient.enableListener(); }
@Test(expected = ListenerRequestFailed.class) public void testErrorDuringEnable() { stubFor(put(urlEqualTo(listenerUrl)).willReturn(aResponse().withFault(Fault.RANDOM_DATA_THEN_CLOSE))); underTest.enableListener(); }