JettyXmppWebSocket implements WebSocket, WebSocket.OnTextMessage, Outbound { public void write(String xml) throws IOException { LOG.info("> " + xml); outbound.sendMessage(xml); } JettyXmppWebSocket(ServerRuntimeContext serverRuntimeContext, StanzaProcessor stanzaProcessor); void onOpen(Connection outbound); void onMessage(String data); void onClose(int closeCode, String message); void write(String xml);  }
@Test public void write() throws IOException { JettyXmppWebSocket context = new JettyXmppWebSocket(serverRuntimeContext, stanzaProcessor); context.onOpen(outbound); context.write("<test></test>"); Mockito.verify(outbound).sendMessage("<test></test>"); }