private void printStat() {
   System.out.println("Generator :" + tester.getGenerator().getPacketsTransmitted());
   System.out.println("Dsp1 input :" + dsp1.getInput().getPacketsReceived());
   System.out.println("Dsp1 output :" + dsp1.getOutput().getPacketsTransmitted());
   System.out.println("Proxy input :" + proxy.getInput().getPacketsReceived());
   System.out.println("Proxy output :" + proxy.getOutput().getPacketsTransmitted());
   System.out.println("Dsp2 input :" + dsp2.getInput().getPacketsReceived());
   System.out.println("Dsp2 output :" + dsp2.getOutput().getPacketsTransmitted());
   System.out.println("Detector :" + tester.getDetector().getPacketsReceived());
 }
  private void testTranscoding(Format fmt) {
    proxy.setFormat(new Format[] {fmt});
    proxy.start();

    dsp1.start();
    dsp2.start();

    tester.start();

    proxy.stop();
    dsp1.stop();
    dsp2.stop();

    //        printStat();
    assertTrue(tester.getMessage(), tester.isPassed());
  }
  @Before
  public void setUp() {
    timer = new TimerImpl();
    timer.start();

    tester = new TransmissionTester2(timer);

    proxy = new Proxy("test");

    ArrayList<CodecFactory> codecFactories = new ArrayList();
    codecFactories.add(pcmaEncoderFactory);
    codecFactories.add(pcmaDecoderFactory);
    codecFactories.add(pcmuEncoderFactory);
    codecFactories.add(pcmuDecoderFactory);
    codecFactories.add(gsmEncoderFactory);
    codecFactories.add(gsmDecoderFactory);
    codecFactories.add(speexEncoderFactory);
    codecFactories.add(speexDecoderFactory);
    codecFactories.add(g729EncoderFactory);
    codecFactories.add(g729DecoderFactory);

    dspFactory.setName("test");
    dspFactory.setCodecFactories(codecFactories);

    dsp1 = (Processor) dspFactory.newInstance(null);
    dsp2 = (Processor) dspFactory.newInstance(null);

    tester.connect(dsp1.getInput());
    dsp1.getOutput().connect(proxy.getInput());
    dsp2.getInput().connect(proxy.getOutput());
    tester.connect(dsp2.getOutput());

    dsp1.getInput().addListener(tester);
    dsp1.getOutput().addListener(tester);

    dsp2.getInput().addListener(tester);
    dsp2.getOutput().addListener(tester);

    proxy.getInput().addListener(tester);
    proxy.getOutput().addListener(tester);
  }