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

Examples of org.jboss.aerogear.io.netty.handler.codec.sockjs.SockJsService


    @Test
    public void webSocketCloseSession() throws Exception {
        final String serviceName = "/closesession";
        final String sessionUrl = serviceName + "/222/" + UUID.randomUUID().toString();
        final SockJsConfig config = SockJsConfig.withPrefix(serviceName).build();
        final SockJsService sockJsService = mock(SockJsService.class);
        final EmbeddedChannel ch = wsChannelForService(factoryFor(sockJsService, config));

        final FullHttpRequest request = webSocketUpgradeRequest(sessionUrl + "/websocket", V13.toHttpHeaderValue());
        ch.writeInbound(request);
View Full Code Here


    private static FullHttpRequest httpGetRequest(final String path, final HttpVersion version) {
        return new DefaultFullHttpRequest(version, GET, path);
    }

    private static EmbeddedChannel channelForMockService(final SockJsConfig config) {
        final SockJsService service = mock(SockJsService.class);
        return channelForService(factoryFor(service, config));
    }
View Full Code Here

public class SockJsSessionTest {

    @Test
    public void setState() throws Exception {
        final SockJsService service = mock(SockJsService.class);
        final SockJsSession session = new SockJsSession("123", service);
        session.setState(State.OPEN);
        assertThat(session.getState(), is(State.OPEN));
    }
View Full Code Here

        assertThat(session.getState(), is(State.OPEN));
    }

    @Test
    public void onOpen() throws Exception {
        final SockJsService service = mock(SockJsService.class);
        final SockJsSession sockJSSession = new SockJsSession("123", service);
        final SockJsSessionContext session = mock(SockJsSessionContext.class);
        sockJSSession.onOpen(session);
        verify(service).onOpen(session);
        assertThat(sockJSSession.getState(), is(State.OPEN));
View Full Code Here

        assertThat(sockJSSession.getState(), is(State.OPEN));
    }

    @Test
    public void onMessage() throws Exception {
        final SockJsService service = mock(SockJsService.class);
        final SockJsSession sockJSSession = new SockJsSession("123", service);
        sockJSSession.onMessage("testing");
        verify(service).onMessage("testing");
    }
View Full Code Here

        verify(service).onMessage("testing");
    }

    @Test
    public void onClose() throws Exception {
        final SockJsService service = mock(SockJsService.class);
        final SockJsSession sockJSSession = new SockJsSession("123", service);
        sockJSSession.onClose();
        verify(service).onClose();
    }
View Full Code Here

        verify(service).onClose();
    }

    @Test
    public void addMessage() throws Exception {
        final SockJsService service = mock(SockJsService.class);
        final SockJsSession sockJSSession = new SockJsSession("123", service);
        sockJSSession.addMessage("hello");
        assertThat(sockJSSession.getAllMessages().size(), is(1));
    }
View Full Code Here

        assertThat(sockJSSession.getAllMessages().size(), is(1));
    }

    @Test
    public void addMessages() throws Exception {
        final SockJsService service = mock(SockJsService.class);
        final SockJsSession sockJSSession = new SockJsSession("123", service);
        sockJSSession.addMessages(new String[]{"hello", "world"});
        final List<String> messages = sockJSSession.getAllMessages();
        assertThat(messages.size(), is(2));
        assertThat(messages.get(0), equalTo("hello"));
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.io.netty.handler.codec.sockjs.SockJsService

Copyright © 2018 www.massapicom. 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.