Пример #1
0
  @Test
  public void testTransmission() throws Exception {
    source1.activate();
    analyzer1.activate();
    audioMixer1.start();

    source2.start();
    analyzer2.activate();
    audioMixer2.start();

    Thread.sleep(5000);

    analyzer1.deactivate();
    analyzer2.deactivate();
    source1.deactivate();
    source2.deactivate();
    audioMixer1.stop();
    audioMixer2.stop();

    int s1[] = analyzer1.getSpectra();
    int s2[] = analyzer2.getSpectra();

    System.out.println("rx-channel1: " + channel1.getPacketsReceived());
    System.out.println("tx-channel1: " + channel1.getPacketsTransmitted());

    System.out.println("rx-channel2: " + channel2.getPacketsReceived());
    System.out.println("tx-channel2: " + channel2.getPacketsTransmitted());

    if (s1.length != 1 || s2.length != 1) {
      System.out.println("Failure ,s1:" + s1.length + ",s2:" + s2.length);
      fcount++;
    } else {
      System.out.println("Passed");
    }

    assertEquals(1, s1.length);
    assertEquals(1, s2.length);
    assertEquals(50, s1[0], 5);
    assertEquals(100, s2[0], 5);
  }
Пример #2
0
  @Test
  public void testHalfDuplex() throws Exception {
    channel1.updateMode(ConnectionMode.RECV_ONLY);
    channel2.updateMode(ConnectionMode.SEND_ONLY);
    source1.activate();
    source2.activate();
    analyzer1.activate();
    audioMixer1.start();
    audioMixer2.start();

    Thread.sleep(5000);

    source1.deactivate();
    source2.deactivate();
    analyzer1.deactivate();
    audioMixer1.stop();
    audioMixer2.stop();

    int s1[] = analyzer1.getSpectra();
    int s2[] = analyzer2.getSpectra();

    System.out.println("rx-channel1: " + channel1.getPacketsReceived());
    System.out.println("tx-channel1: " + channel1.getPacketsTransmitted());

    System.out.println("rx-channel2: " + channel2.getPacketsReceived());
    System.out.println("tx-channel2: " + channel2.getPacketsTransmitted());

    if (s2.length != 0 || s1.length != 1) {
      fcount++;
    } else {
      System.out.println("Passed");
    }

    assertEquals(0, fcount);
    assertEquals(50, s1[0], 5);
  }