@Test public void test_connection() { final EngineIoServer engineIoServer = new EngineIoServer(); final SocketIoServer server = new SocketIoServer(engineIoServer); final SocketIoNamespace namespace = server.namespace("/"); assertNotNull(namespace); final Emitter.Listener connectionListener = Mockito.mock(Emitter.Listener.class); namespace.on("connect", connectionListener); namespace.on("connection", connectionListener); engineIoServer.handleWebSocket(new EngineIoWebSocket() { @Override public Map<String, String> getQuery() { return new HashMap<>(); } @Override public void write(String message) { } @Override public void write(byte[] message) { } @Override public void close() { } }); Mockito.verify(connectionListener, Mockito.times(2)) .call(Mockito.any(SocketIoSocket.class)); }
public synchronized SocketIoNamespace namespace(String namespace) { if (namespace.charAt(0) != '/') { namespace = "/" + namespace; } SocketIoNamespaceImpl nsp = mNamespaces.get(namespace); if (nsp == null) { nsp = new SocketIoNamespaceImpl(this, namespace); mNamespaces.put(namespace, nsp); } return nsp; }
SocketIoServer { public synchronized SocketIoNamespace namespace(String namespace) { if (namespace.charAt(0) != '/') { namespace = "/" + namespace; } SocketIoNamespaceImpl nsp = mNamespaces.get(namespace); if (nsp == null) { nsp = new SocketIoNamespaceImpl(this, namespace); mNamespaces.put(namespace, nsp); } return nsp; } }
SocketIoServer { public synchronized SocketIoNamespace namespace(String namespace) { if (namespace.charAt(0) != '/') { namespace = "/" + namespace; } SocketIoNamespaceImpl nsp = mNamespaces.get(namespace); if (nsp == null) { nsp = new SocketIoNamespaceImpl(this, namespace); mNamespaces.put(namespace, nsp); } return nsp; } SocketIoServer(EngineIoServer server);  SocketIoServer(EngineIoServer server, SocketIoServerOptions options); }
SocketIoServer { public synchronized SocketIoNamespace namespace(String namespace) { if (namespace.charAt(0) != '/') { namespace = "/" + namespace; } SocketIoNamespaceImpl nsp = mNamespaces.get(namespace); if (nsp == null) { nsp = new SocketIoNamespaceImpl(this, namespace); mNamespaces.put(namespace, nsp); } return nsp; } SocketIoServer(EngineIoServer server);  SocketIoServer(EngineIoServer server, SocketIoServerOptions options); boolean hasNamespace(String namespace); synchronized SocketIoNamespace namespace(String namespace); synchronized SocketIoNamespace namespace(SocketIoNamespaceProvider namespaceProvider); synchronized SocketIoNamespace namespace(final Pattern namespaceRegex); }
SocketIoServer { public synchronized SocketIoNamespace namespace(String namespace) { if (namespace.charAt(0) != '/') { namespace = "/" + namespace; } SocketIoNamespaceImpl nsp = mNamespaces.get(namespace); if (nsp == null) { nsp = new SocketIoNamespaceImpl(this, namespace); mNamespaces.put(namespace, nsp); } return nsp; } SocketIoServer(EngineIoServer server);  SocketIoServer(EngineIoServer server, SocketIoServerOptions options); boolean hasNamespace(String namespace); synchronized SocketIoNamespace namespace(String namespace); synchronized SocketIoNamespace namespace(SocketIoNamespaceProvider namespaceProvider); synchronized SocketIoNamespace namespace(final Pattern namespaceRegex);  }