@Before
  public void setUp()
      throws ResourceUnavailableException, IOException, TooManyConnectionsException {
    ConnectionState.OPEN.setTimeout(5);

    // use default clock
    clock = new DefaultClock();

    // create single thread scheduler
    scheduler = new Scheduler();
    scheduler.setClock(clock);
    scheduler.start();

    channelsManager = new ChannelsManager(new UdpManager(scheduler));
    channelsManager.setScheduler(scheduler);

    resourcesPool = new ResourcesPool(scheduler, channelsManager, dspFactory);

    // assign scheduler to the endpoint
    endpoint = new MyTestEndpoint("test");
    endpoint.setScheduler(scheduler);
    endpoint.setResourcesPool(resourcesPool);
    endpoint.start();

    connection = (BaseConnection) endpoint.createConnection(ConnectionType.LOCAL, false);
  }
Beispiel #2
0
  @Before
  public void setUp()
      throws ResourceUnavailableException, TooManyConnectionsException, IOException {
    super.setup();

    resourcesPool = new ResourcesPool(mediaScheduler, channelsManager, dspFactory);
    // assign scheduler to the endpoint
    endpoint1 = new MyTestEndpoint("test-1");
    endpoint1.setScheduler(mediaScheduler);
    endpoint1.setResourcesPool(resourcesPool);
    endpoint1.setFreq(400);
    endpoint1.start();

    endpoint2 = new MyTestEndpoint("test-2");
    endpoint2.setScheduler(mediaScheduler);
    endpoint2.setResourcesPool(resourcesPool);
    endpoint2.setFreq(200);
    endpoint2.start();

    endpoint3 = new MyTestEndpoint("test-3");
    endpoint3.setScheduler(mediaScheduler);
    endpoint3.setResourcesPool(resourcesPool);
    endpoint3.setFreq(600);
    endpoint3.start();

    endpoint4 = new MyTestEndpoint("test-4");
    endpoint4.setScheduler(mediaScheduler);
    endpoint4.setResourcesPool(resourcesPool);
    endpoint4.setFreq(800);
    endpoint4.start();

    sine1 = endpoint1.getResource(MediaType.AUDIO, ComponentType.SINE);
    sine2 = endpoint2.getResource(MediaType.AUDIO, ComponentType.SINE);
    sine3 = endpoint3.getResource(MediaType.AUDIO, ComponentType.SINE);
    sine4 = endpoint4.getResource(MediaType.AUDIO, ComponentType.SINE);

    analyzer1 = endpoint1.getResource(MediaType.AUDIO, ComponentType.SPECTRA_ANALYZER);
    analyzer2 = endpoint2.getResource(MediaType.AUDIO, ComponentType.SPECTRA_ANALYZER);
    analyzer3 = endpoint3.getResource(MediaType.AUDIO, ComponentType.SPECTRA_ANALYZER);
    analyzer4 = endpoint4.getResource(MediaType.AUDIO, ComponentType.SPECTRA_ANALYZER);
  }
  @Before
  public void setUp()
      throws ResourceUnavailableException, IOException, TooManyConnectionsException {
    // use default clock
    clock = new WallClock();

    // create single thread scheduler
    scheduler = new PriorityQueueScheduler();
    scheduler.setClock(clock);
    scheduler.start();

    channelsManager = new ChannelsManager(new UdpManager(new ServiceScheduler()));
    channelsManager.setScheduler(scheduler);

    resourcesPool = new ResourcesPool(scheduler, channelsManager, dspFactory);
    // assign scheduler to the endpoint
    endpoint = new MyTestEndpoint("test");
    endpoint.setScheduler(scheduler);
    endpoint.setResourcesPool(resourcesPool);
    endpoint.start();

    connection = (BaseConnection) endpoint.createConnection(ConnectionType.LOCAL, false);
    connection.addListener(this);
  }