AMRMProxyService extends AbstractService implements
    ApplicationMasterProtocol { @Override public AllocateResponse allocate(AllocateRequest request) throws YarnException, IOException { AMRMTokenIdentifier amrmTokenIdentifier = YarnServerSecurityUtils.authorizeRequest(); RequestInterceptorChainWrapper pipeline = getInterceptorChain(amrmTokenIdentifier); AllocateResponse allocateResponse = pipeline.getRootInterceptor().allocate(request); updateAMRMTokens(amrmTokenIdentifier, pipeline, allocateResponse); return allocateResponse; } 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 testAllocateRequestWithoutRegistering() throws Exception { try { allocate(1); Assert .fail("The request to allocate application master should have failed"); } catch (Throwable ex) { LOG.info("AllocateRequest failed as expected because AM was not registered"); } }