AMRMProxyService extends AbstractService implements
    ApplicationMasterProtocol { @Override public FinishApplicationMasterResponse finishApplicationMaster( FinishApplicationMasterRequest request) throws YarnException, IOException { LOG.info("Finishing application master. Tracking Url:" + request.getTrackingUrl()); RequestInterceptorChainWrapper pipeline = authorizeAndGetInterceptorChain(); return pipeline.getRootInterceptor().finishApplicationMaster(request); } AMRMProxyService(Context nmContext, AsyncDispatcher dispatcher); @Override RegisterApplicationMasterResponse registerApplicationMaster(
      RegisterApplicationMasterRequest request); @Override FinishApplicationMasterResponse finishApplicationMaster(
      FinishApplicationMasterRequest request); @Override AllocateResponse allocate(AllocateRequest request); void processApplicationStartRequest(StartContainerRequest request);  }
@Test public void testFinishInvalidApplicationMaster() throws Exception { try { finishApplicationMaster(4, FinalApplicationStatus.SUCCEEDED); Assert .fail("The request to finish application master should have failed"); } catch (Throwable ex) { LOG.info("Finish registration failed as expected because it was not registered"); } }