}
@Test
public void testHeartbeat() throws IOException, ServletException {
// Open connection
AtmosphereRequest request = new AtmosphereRequest.Builder()
.pathInfo("/heartbeat")
.method("GET")
.build();
request.header(X_ATMOSPHERE_TRANSPORT, WEBSOCKET_TRANSPORT);
framework.doCometSupport(request, AtmosphereResponse.newInstance());
// Check suspend
final AtmosphereResource res = r.get();
assertNotNull(res);
// Send heartbeat
request = new AtmosphereRequest.Builder()
.pathInfo("/heartbeat")
.method("GET")
.body(Heartbeat.paddingData)
.build();
request.header(X_ATMOSPHERE_TRANSPORT, WEBSOCKET_TRANSPORT);
request.setAttribute(HeartbeatInterceptor.INTERCEPTOR_ADDED, "");
res.initialize(res.getAtmosphereConfig(), res.getBroadcaster(), request, AtmosphereResponse.newInstance(), framework.getAsyncSupport(), res.getAtmosphereHandler());
request.setAttribute(FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE, res);
framework.doCometSupport(request, AtmosphereResponse.newInstance());
assertNotNull(message.get());
assertEquals(message.get(), Heartbeat.paddingData);
}