@BeforeMethod public void create() throws Throwable { framework = new AtmosphereFramework(); framework.setAsyncSupport(mock(AsyncSupport.class)); framework.init( new ServletConfig() { @Override public String getServletName() { return "void"; } @Override public ServletContext getServletContext() { return mock(ServletContext.class); } @Override public String getInitParameter(String name) { return null; } @Override public Enumeration<String> getInitParameterNames() { return null; } }); }
@BeforeMethod public void create() throws Throwable { framework = new AtmosphereFramework(); framework.setDefaultBroadcasterClassName(SimpleBroadcaster.class.getName()); framework .setAsyncSupport( new AsynchronousProcessor(framework.getAtmosphereConfig()) { @Override public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { return suspended(req, res); } public void action(AtmosphereResourceImpl r) { try { resumed(r.getRequest(), r.getResponse()); } catch (IOException e) { e.printStackTrace(); } catch (ServletException e) { e.printStackTrace(); } } }) .init(); }