### Question:
MyResource { @GET public void getList(@Suspended final AsyncResponse ar) throws NamingException { ar.setTimeoutHandler(new TimeoutHandler() { @Override public void handleTimeout(AsyncResponse ar) { ar.resume("Operation timed out"); } }); ar.setTimeout(4000, TimeUnit.MILLISECONDS); ar.register(new MyCompletionCallback()); ar.register(new MyConnectionCallback()); ManagedThreadFactory threadFactory = (ManagedThreadFactory) new InitialContext() .lookup("java:comp/DefaultManagedThreadFactory"); Executors.newSingleThreadExecutor(threadFactory).submit(new Runnable() { @Override public void run() { try { Thread.sleep(3000); ar.resume(response[0]); } catch (InterruptedException ex) { } } }); }  @GET void getList(@Suspended final AsyncResponse ar);  }### Answer:
@Test public void testGetList() { String result = target.request().get(String.class); assertEquals("apple", result); }