TomcatXmppWebSocketServlet extends WebSocketServlet { @Override protected StreamInbound createWebSocketInbound(String subProtocol) { TomcatXmppWebSocket sessionContext = new TomcatXmppWebSocket(serverRuntimeContext, stanzaProcessor); return sessionContext; } TomcatXmppWebSocketServlet();  TomcatXmppWebSocketServlet(ServerRuntimeContext serverRuntimeContext, StanzaProcessor stanzaProcessor); @Override void init(); static final String SERVER_RUNTIME_CONTEXT_ATTRIBUTE; }
@Test public void doWebSocketConnectWithDirectCstr() throws ServletException { TomcatXmppWebSocketServlet servlet = new TomcatXmppWebSocketServlet(serverRuntimeContext, stanzaProcessor); StreamInbound webSocket = servlet.createWebSocketInbound("xmpp"); Assert.assertTrue(webSocket instanceof TomcatXmppWebSocket); }
@Test @Ignore("sub protocol check temporarily disabled for Tomcat") public void doWebSocketConnectWithInvalidSubprotocl() throws ServletException { TomcatXmppWebSocketServlet servlet = new TomcatXmppWebSocketServlet(serverRuntimeContext, stanzaProcessor); StreamInbound webSocket = servlet.createWebSocketInbound("dummy"); Assert.assertNull(webSocket); }