public void testEntity() throws Exception { int port = PortAllocator.getFreePort(); String address = "http://localhost:" + port + "/entity"; Endpoint endpoint = Endpoint.create(new MyEndpoint()); endpoint.publish(address); try { HTTPResponseInfo rInfo = sendEntity(address); String resp = rInfo.getResponseBody(); if (resp.contains("x1y1")) { fail("Entity is getting resolved"); } int code = rInfo.getResponseCode(); assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, code); } finally { endpoint.stop(); } }
/** * Sets up a Endpoint for listenign to non-anonymous responses, which uses the Exchanger to pass * the request message. This in unnecessary for anonymous tests. * * @throws Exception */ protected void setUp() throws Exception { super.setUp(); nonAnonAddress = getNonAnonymousClientAddress(); responseProcessor = Endpoint.create(new NonAnonymousRespProcessor(respMsgExchanger)); responseProcessor.publish(nonAnonAddress); }