org.red5.server.adapter.MultiThreadedApplicationAdapter Java Examples

The following examples show how to use org.red5.server.adapter.MultiThreadedApplicationAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSocketPlugin.java    From red5-websocket with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void setApplication(MultiThreadedApplicationAdapter application) {
    log.info("WebSocketPlugin application: {}", application);
    // get the app scope
    final IScope appScope = application.getScope();
    // put if not already there
    managerMap.putIfAbsent(appScope, new WebSocketScopeManager());
    // add the app scope to the manager
    managerMap.get(appScope).setApplication(appScope);
    super.setApplication(application);
}
 
Example #2
Source File: WebSocketServerTest.java    From red5-websocket with Apache License 2.0 4 votes vote down vote up
@Test
public void testUriWithParams() throws Throwable {
    log.info("\ntestUriWithParams enter");
    // create the server instance
    Thread server = new Thread() {
        @Override
        public void run() {
            log.debug("Server thread run");
            try {
                WSServer.main(null);
            } catch (IOException e) {
                log.error("Error in server thread", e);
            }
            log.debug("Server thread exit");
        }
    };
    server.setDaemon(true);
    server.start();
    // add plugin to the registry
    WebSocketPlugin plugin = new WebSocketPlugin();
    PluginRegistry.register(plugin);
    // start plugin
    plugin.doStart();
    // create a scope for the manager
    IScope appScope = new GlobalScope();
    // create an app
    MultiThreadedApplicationAdapter app = new MultiThreadedApplicationAdapter();
    app.setScope(appScope);
    // add the app
    plugin.setApplication(app);
    // get the manager
    WebSocketScopeManager manager = plugin.getManager(appScope);
    manager.setApplication(appScope);
    // wait for server
    while (!WSServer.isListening()) {
        Thread.sleep(10L);
    }
    // create the client
    final TyrusWSClient client = new TyrusWSClient();
    //final TyrusWSClient client = new TyrusWSClient(8192 * 10);
    Thread t = new Thread(new Runnable() {
        public void run() {
            client.start();
        }
    }, "tyrus");
    t.start();
    t.join(5000);
    // send a message
    //client.sendMessage("This is a test");
    // terminate client
    client.terminate();
    // stop server
    server.interrupt();
    WSServer.stop();
    // stop plugin
    PluginRegistry.shutdown();
    log.info("testUriWithParams exit");
}
 
Example #3
Source File: Red5Plugin.java    From red5-server-common with Apache License 2.0 2 votes vote down vote up
/**
 * Set the application making use of this plug-in.
 * 
 * @param application
 *            application
 */
public void setApplication(MultiThreadedApplicationAdapter application) {
}