Package org.jboss.aerogear.io.netty.handler.codec.sockjs

Examples of org.jboss.aerogear.io.netty.handler.codec.sockjs.SockJsServiceFactory.config()


     * Equivalent to BaseUrlGreeting.test_greeting in sockjs-protocol-0.3.3.py.
     */
    @Test
    public void baseUrlGreetingTestGreeting() throws Exception {
        final SockJsServiceFactory factory = echoService();
        final EmbeddedChannel ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix()));
        final FullHttpResponse response = ch.readOutbound();
        assertThat(response.getStatus().code(), is(HttpResponseStatus.OK.code()));
        assertThat(response.headers().get(CONTENT_TYPE), equalTo("text/plain; charset=UTF-8"));
        assertThat(response.content().toString(UTF_8), equalTo("Welcome to SockJS!\n"));
View Full Code Here


     */
    @Test
    public void baseUrlGreetingTestGreeting() throws Exception {
        final SockJsServiceFactory factory = echoService();
        final EmbeddedChannel ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix()));
        final FullHttpResponse response = ch.readOutbound();
        assertThat(response.getStatus().code(), is(HttpResponseStatus.OK.code()));
        assertThat(response.headers().get(CONTENT_TYPE), equalTo("text/plain; charset=UTF-8"));
        assertThat(response.content().toString(UTF_8), equalTo("Welcome to SockJS!\n"));
        verifyNoSET_COOKIE(response);
View Full Code Here

     * Equivalent to IframePage.test_cacheability in sockjs-protocol-0.3.3.py.
     */
    @Test
    public void iframeCachability() throws Exception {
        final SockJsServiceFactory factory = echoService();
        EmbeddedChannel ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix() + "/iframe.html"));
        final String etag1 = getEtag((FullHttpResponse) ch.readOutbound());

        ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix() + "/iframe.html"));
View Full Code Here

     */
    @Test
    public void iframeCachability() throws Exception {
        final SockJsServiceFactory factory = echoService();
        EmbeddedChannel ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix() + "/iframe.html"));
        final String etag1 = getEtag((FullHttpResponse) ch.readOutbound());

        ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix() + "/iframe.html"));
        final String etag2 = getEtag((FullHttpResponse) ch.readOutbound());
View Full Code Here

        final SockJsServiceFactory factory = echoService();
        EmbeddedChannel ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix() + "/iframe.html"));
        final String etag1 = getEtag((FullHttpResponse) ch.readOutbound());

        ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix() + "/iframe.html"));
        final String etag2 = getEtag((FullHttpResponse) ch.readOutbound());
        assertThat(etag1, equalTo(etag2));

        final FullHttpRequest requestWithEtag = httpRequest(factory.config().prefix() + "/iframe.html");
View Full Code Here

        EmbeddedChannel ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix() + "/iframe.html"));
        final String etag1 = getEtag((FullHttpResponse) ch.readOutbound());

        ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix() + "/iframe.html"));
        final String etag2 = getEtag((FullHttpResponse) ch.readOutbound());
        assertThat(etag1, equalTo(etag2));

        final FullHttpRequest requestWithEtag = httpRequest(factory.config().prefix() + "/iframe.html");
        requestWithEtag.headers().set(IF_NONE_MATCH, etag1);
View Full Code Here

        ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix() + "/iframe.html"));
        final String etag2 = getEtag((FullHttpResponse) ch.readOutbound());
        assertThat(etag1, equalTo(etag2));

        final FullHttpRequest requestWithEtag = httpRequest(factory.config().prefix() + "/iframe.html");
        requestWithEtag.headers().set(IF_NONE_MATCH, etag1);
        ch = channelForMockService(factory.config());
        ch.writeInbound(requestWithEtag);
        final FullHttpResponse response = ch.readOutbound();
        assertThat(response.getStatus(), equalTo(HttpResponseStatus.NOT_MODIFIED));
View Full Code Here

        final String etag2 = getEtag((FullHttpResponse) ch.readOutbound());
        assertThat(etag1, equalTo(etag2));

        final FullHttpRequest requestWithEtag = httpRequest(factory.config().prefix() + "/iframe.html");
        requestWithEtag.headers().set(IF_NONE_MATCH, etag1);
        ch = channelForMockService(factory.config());
        ch.writeInbound(requestWithEtag);
        final FullHttpResponse response = ch.readOutbound();
        assertThat(response.getStatus(), equalTo(HttpResponseStatus.NOT_MODIFIED));
        assertThat(response.headers().get(CONTENT_TYPE), is(nullValue()));
        assertThat(response.content().isReadable(), is(false));
View Full Code Here

     * Equivalent to InfoTest.test_options in sockjs-protocol-0.3.3.py.
     */
    @Test
    public void infoTestOptions() throws Exception {
        final SockJsServiceFactory factory = echoService();
        final EmbeddedChannel ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix(), OPTIONS));
        final HttpResponse response = ch.readOutbound();
        assertThat(response.getStatus(), is(HttpResponseStatus.NO_CONTENT));
        assertCORSPreflightResponseHeaders(response);
        SockJsTestUtil.assertCORSHeaders(response, "*");
 
View Full Code Here

     */
    @Test
    public void infoTestOptions() throws Exception {
        final SockJsServiceFactory factory = echoService();
        final EmbeddedChannel ch = channelForMockService(factory.config());
        ch.writeInbound(httpRequest(factory.config().prefix(), OPTIONS));
        final HttpResponse response = ch.readOutbound();
        assertThat(response.getStatus(), is(HttpResponseStatus.NO_CONTENT));
        assertCORSPreflightResponseHeaders(response);
        SockJsTestUtil.assertCORSHeaders(response, "*");
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.