HomeController { @RateLimiter(base = RateLimiter.Base.General, permits = 2, timeUnit = TimeUnit.MINUTES) @PermitAll @GET @Path("/world/{id}") @Produces("application/json") public Response helloworld(@Context HttpHeaders headers) throws Exception { long t = System.currentTimeMillis(); if (t % 2 == 0) { Helloworld hw = new Helloworld("Welcome, Hello World"); return Response.status(200).entity(hw).build(); } else { Thread.sleep(10000); Helloworld hw = new Helloworld("Bad Luck"); return Response.status(200).entity(hw).build(); } }  @RateLimiter(base = RateLimiter.Base.General, permits = 2, timeUnit = TimeUnit.MINUTES) @PermitAll @GET @Path("/world/{id}") @Produces("application/json") Response helloworld(@Context HttpHeaders headers); @PermitAll @GET @Path("/error") @Produces("application/json") Response error(); @PermitAll @POST @Path("/login") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.TEXT_PLAIN }) Response login(UserLogin userLogin); @PermitAll @AntiDefacement @POST @Path("/loginecho") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) Response loginecho(UserLogin userLogin); @RolesAllowed({ "USER", "MAIN_FORCES" }) @POST @Path("/singlesave") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) Response save(Article article); @RolesAllowed("MAIN_FORCES") @POST @Path("/multisave") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) List<Article> save(@QueryParam("multi") boolean isMulti, List<Article> articles);  }
@Test public void testHelloworld() throws InterruptedException { ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(buildUrl("hello/world/2345?multi=true")); Response response = target.request().header("UserToken", "").get(); Helloworld hw = response.readEntity(Helloworld.class); System.out.println(hw.getMessage()); while(true) { Thread.sleep(1000); } }