PingResponseHandler implements ResponseHandler { @Override public void onFailure( Throwable error ) { log.trace( "Channel %s failed ping %s", channel, error ); result.setSuccess( false ); } PingResponseHandler( Promise<Boolean> result, Channel channel, Logger log ); @Override void onSuccess( Map<String,Value> metadata ); @Override void onFailure( Throwable error ); @Override void onRecord( Value[] fields );  }
@Test void shouldResolvePromiseOnFailure() { Promise<Boolean> promise = newPromise(); PingResponseHandler handler = newHandler( promise ); handler.onFailure( new RuntimeException() ); assertTrue( promise.isSuccess() ); assertFalse( promise.getNow() ); }