FlumeLog4jAvroAppender extends AppenderSkeleton { public void setPort(int port) { this.port = port; } FlumeLog4jAvroAppender(); @Override void close(); @Override boolean requiresLayout(); FlumeEventAvroServer getClient(); void setClient(FlumeEventAvroServer client); String getHostname(); void setHostname(String hostname); int getPort(); void setPort(int port); int getReconnectAttempts(); void setReconnectAttempts(int reconnectAttempts);  }
@Test public void testConnectionRefused() { ((FlumeLog4jAvroAppender) avroLogger.getAppender("avro")).setPort(44000); boolean caughtException = false; try { avroLogger.info("message 1"); } catch (Throwable t) { logger.debug("Logging to a non-existant server failed (as expected)", t); caughtException = true; } Assert.assertTrue(caughtException); }