protected void tearDown() throws Exception {
   super.tearDown();
   // Sleep to give endpoint some time to process the non-anonymous request
   // this is needed in case the object is exchanged between client and non-anonymous response
   // endpoint,
   // which leads to test tearDown(), yet the ack to non-anonymous response is not sent back to
   // server yet.
   Thread.sleep(5000);
   if (responseProcessor != null) responseProcessor.stop();
 }
示例#2
0
 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();
   }
 }