TomcatXmppWebSocket extends MessageInbound implements Outbound { @Override protected void onTextMessage(CharBuffer message) throws IOException { String data = message.toString(); LOG.info("< " + data); sessionContext.onMessage(data); } TomcatXmppWebSocket(ServerRuntimeContext serverRuntimeContext, StanzaProcessor stanzaProcessor); void onOpen(WsOutbound outbound); void onClose(int closeCode, String message); void write(String xml);  }
@Test public void onMessage() throws IOException { TomcatXmppWebSocket context = new TomcatXmppWebSocket(serverRuntimeContext, stanzaProcessor); context.onTextMessage(CharBuffer.wrap("<test></test>")); Stanza expected = new StanzaBuilder("test").build(); Mockito.verify(stanzaProcessor).processStanza(Mockito.eq(serverRuntimeContext), Mockito.any(InternalSessionContext.class), Mockito.eq(expected), Mockito.any(SessionStateHolder.class)); }