@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")); assertThat(messages.get(1), equalTo("world")); assertThat(sockJSSession.getAllMessages().size(), is(0)); }
@SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } }
SockJsSession { @SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } } }
SockJsSession { @SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } } SockJsSession(final String sessionId, final SockJsService service); }
SockJsSession { @SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext openContext(); void setOpenContext(final ChannelHandlerContext ctx); void setState(State newState); State getState(); boolean inuse(); void setInuse(final boolean use); SockJsConfig config(); String sessionId(); void onMessage(final String message); void onOpen(final SockJsSessionContext session); void onClose(); void addMessage(final String message); List<String> getAllMessages(); @SuppressWarnings("ManualArrayToCollectionCopy") void addMessages(final String[] messages); long timestamp(); @Override String toString(); }
SockJsSession { @SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext openContext(); void setOpenContext(final ChannelHandlerContext ctx); void setState(State newState); State getState(); boolean inuse(); void setInuse(final boolean use); SockJsConfig config(); String sessionId(); void onMessage(final String message); void onOpen(final SockJsSessionContext session); void onClose(); void addMessage(final String message); List<String> getAllMessages(); @SuppressWarnings("ManualArrayToCollectionCopy") void addMessages(final String[] messages); long timestamp(); @Override String toString();  }