Examples of MemoryWebSocketStore


Examples of org.apache.camel.component.atmosphere.websocket.MemoryWebSocketStore

public class MemoryWebSocketStoreTest extends Assert {
   
    @Test
    public void testAddAndRemove() throws Exception {
        MemoryWebSocketStore store = new MemoryWebSocketStore();
        WebSocket webSocket1 = EasyMock.createMock(WebSocket.class);
        WebSocket webSocket2 = EasyMock.createMock(WebSocket.class);
       
        String connectionKey1 = UUID.randomUUID().toString();
        String connectionKey2 = UUID.randomUUID().toString();
       
        store.addWebSocket(connectionKey1, webSocket1);
        verifyGet(store, connectionKey1, webSocket1, true);
        assertEquals(1, store.getAllWebSockets().size());
       
        store.addWebSocket(connectionKey2, webSocket2);
        verifyGet(store, connectionKey2, webSocket2, true);
        verifyGet(store, connectionKey1, webSocket1, true);
        assertEquals(2, store.getAllWebSockets().size());
       
        store.removeWebSocket(connectionKey1);
        verifyGet(store, connectionKey1, webSocket1, false);

        store.removeWebSocket(webSocket2);
        verifyGet(store, connectionKey2, webSocket2, false);
       
        assertEquals(0, store.getAllWebSockets().size());
    }
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.