use of org.atmosphere.runtime.AtmosphereRequest in project atmosphere by Atmosphere.
the class ManagedAtmosphereHandlerTest method testPriority.
@Test
public void testPriority() throws IOException, ServletException {
AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/priority").method("GET").build();
request.header(X_ATMOSPHERE_TRANSPORT, LONG_POLLING_TRANSPORT);
framework.doCometSupport(request, AtmosphereResponseImpl.newInstance());
assertEquals(framework.getAtmosphereHandlers().get("/priority").interceptors.getFirst().toString(), "XXX");
assertNotNull(r.get());
}
use of org.atmosphere.runtime.AtmosphereRequest in project atmosphere by Atmosphere.
the class ManagedAtmosphereHandlerTest method testGet.
@Test
public void testGet() throws IOException, ServletException {
AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/a").method("GET").build();
framework.doCometSupport(request, AtmosphereResponseImpl.newInstance());
r.get().resume();
assertNotNull(r.get());
}
use of org.atmosphere.runtime.AtmosphereRequest in project atmosphere by Atmosphere.
the class ManagedAtmosphereHandlerTest method testBinaryPost.
@Test
public void testBinaryPost() throws IOException, ServletException {
AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/b").method("POST").body("test".getBytes()).build();
framework.doCometSupport(request, AtmosphereResponseImpl.newInstance());
assertNotNull(r.get());
r.get().resume();
}
use of org.atmosphere.runtime.AtmosphereRequest in project atmosphere by Atmosphere.
the class ManagedAtmosphereHandlerTest method testHeartbeat.
@Test
public void testHeartbeat() throws IOException, ServletException {
// Open connection
AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/heartbeat").method("GET").build();
request.header(X_ATMOSPHERE_TRANSPORT, WEBSOCKET_TRANSPORT);
framework.doCometSupport(request, AtmosphereResponseImpl.newInstance());
// Check suspend
final AtmosphereResource res = r.get();
assertNotNull(res);
// Send heartbeat
request = new AtmosphereRequestImpl.Builder().pathInfo("/heartbeat").method("POST").body(Heartbeat.paddingData).build();
request.header(X_ATMOSPHERE_TRANSPORT, WEBSOCKET_TRANSPORT);
request.setAttribute(HeartbeatInterceptor.INTERCEPTOR_ADDED, "");
res.initialize(res.getAtmosphereConfig(), res.getBroadcaster(), request, AtmosphereResponseImpl.newInstance(), framework.getAsyncSupport(), res.getAtmosphereHandler());
request.setAttribute(FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE, res);
framework.doCometSupport(request, AtmosphereResponseImpl.newInstance());
assertNotNull(message.get());
assertEquals(message.get(), Heartbeat.paddingData);
}
use of org.atmosphere.runtime.AtmosphereRequest in project atmosphere by Atmosphere.
the class ManagedAtmosphereHandlerTest method testInputStreamMessage.
@Test
public void testInputStreamMessage() throws IOException, ServletException {
AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/inputStreamInjection").method("GET").build();
framework.doCometSupport(request, AtmosphereResponseImpl.newInstance());
assertNotNull(r.get());
r.get().resume();
assertNotNull(message.get());
assertEquals(message.get(), "message");
}
Aggregations