### Question:
NMAuditLogger { static void start(Keys key, String value, StringBuilder b) { b.append(key.name()).append(AuditConstants.KEY_VAL_SEPARATOR).append(value); }  static void logSuccess(String user, String operation, String target,
      ApplicationId appId, ContainerId containerId); static void logSuccess(String user, String operation, String target); static void logFailure(String user, String operation, String target, 
      String description, ApplicationId appId, ContainerId containerId); static void logFailure(String user, String operation, 
                         String target, String description);  }### Answer:
@Test public void testNMAuditLoggerWithIP() throws Exception { Configuration conf = new Configuration(); Server server = RPC.getServer(TestProtocol.class, new MyTestRPCServer(), "0.0.0.0", 0, 5, true, conf, null); server.start(); InetSocketAddress addr = NetUtils.getConnectAddress(server); TestProtocol proxy = (TestProtocol)RPC.getProxy(TestProtocol.class, TestProtocol.versionID, addr, conf); proxy.ping(); server.stop(); }
@Test public void testNMAuditLoggerWithIP() throws Exception { Configuration conf = new Configuration(); Server server = RPC.getServer(new MyTestRPCServer(), "0.0.0.0", 0, conf); server.start(); InetSocketAddress addr = NetUtils.getConnectAddress(server); TestProtocol proxy = (TestProtocol)RPC.getProxy(TestProtocol.class, TestProtocol.versionID, addr, conf); proxy.ping(); server.stop(); }
@Test public void testNMAuditLoggerWithIP() throws Exception { Configuration conf = new Configuration(); RPC.setProtocolEngine(conf, TestRpcService.class, ProtobufRpcEngine.class); MyTestRPCServer serverImpl = new MyTestRPCServer(); BlockingService service = TestRpcServiceProtos.TestProtobufRpcProto .newReflectiveBlockingService(serverImpl); Server server = new RPC.Builder(conf) .setProtocol(TestRpcBase.TestRpcService.class) .setInstance(service).setBindAddress("0.0.0.0") .setPort(0).setNumHandlers(5).setVerbose(true).build(); server.start(); InetSocketAddress addr = NetUtils.getConnectAddress(server); TestRpcService proxy = RPC.getProxy(TestRpcService.class, TestProtocol.versionID, addr, conf); TestProtos.EmptyRequestProto pingRequest = TestProtos.EmptyRequestProto.newBuilder().build(); proxy.ping(null, pingRequest); server.stop(); RPC.stopProxy(proxy); }