### Question:
RpcClientFactory { public static RpcClient getDefaultInstance(String hostname, Integer port) throws FlumeException { return getDefaultInstance(hostname, port, 0); }  @SuppressWarnings("unchecked") static RpcClient getInstance(Properties properties); static RpcClient getInstance(File propertiesFile); @Deprecated static RpcClient getInstance(String hostname, Integer port); static RpcClient getDefaultInstance(String hostname, Integer port); @Deprecated static RpcClient getInstance(String hostname, Integer port,
      Integer batchSize); static RpcClient getDefaultInstance(String hostname, Integer port,
      Integer batchSize); static RpcClient getThriftInstance(String hostname, Integer port,
    Integer batchSize); static RpcClient getThriftInstance(String hostname, Integer port); static RpcClient getThriftInstance(Properties props);  }### Answer:
@Test public void testTwoParamSimpleAppend() throws FlumeException, EventDeliveryException { RpcClient client = null; Server server = RpcTestUtils.startServer(new OKAvroHandler()); try { client = RpcClientFactory.getDefaultInstance(localhost, server.getPort()); client.append(EventBuilder.withBody("wheee!!!", Charset.forName("UTF8"))); } finally { RpcTestUtils.stopServer(server); if (client != null) client.close(); } }
@Test public void testThreeParamBatchAppend() throws FlumeException, EventDeliveryException { int batchSize = 7; RpcClient client = null; Server server = RpcTestUtils.startServer(new OKAvroHandler()); try { client = RpcClientFactory.getDefaultInstance(localhost, server.getPort(), batchSize); List<Event> events = new ArrayList<Event>(); for (int i = 0; i < batchSize; i++) { events.add(EventBuilder.withBody("evt: " + i, Charset.forName("UTF8"))); } client.appendBatch(events); } finally { RpcTestUtils.stopServer(server); if (client != null) client.close(); } }
@Test public void testTwoParamBatchAppendOverflow() throws FlumeException, EventDeliveryException { RpcClient client = null; Server server = RpcTestUtils.startServer(new OKAvroHandler()); try { client = RpcClientFactory.getDefaultInstance(localhost, server.getPort()); int batchSize = client.getBatchSize(); int moreThanBatch = batchSize + 1; List<Event> events = new ArrayList<Event>(); for (int i = 0; i < moreThanBatch; i++) { events.add(EventBuilder.withBody("evt: " + i, Charset.forName("UTF8"))); } client.appendBatch(events); } finally { RpcTestUtils.stopServer(server); if (client != null) client.close(); } }