private static SourceEnd addStream(SourceEnd src) {

    SinkEnd snk = createPair();

    Replicator r2 = new Replicator();
    AsyncDrain ad = new AsyncDrain();

    r2.getSource().connect(snk);
    src.connect(r2.getSink1());
    ad.getSource1().connect(r2.getSink2());

    return ad.getSource2();
  }
  private static SinkEnd createPair() {
    Writer wrt = new ContinuousWriter(1);
    //        {
    //            @Override
    //            public void updateState() {
    //                System.out.println("updating <"+getEnds().get(0).getName()+">");
    //                if (limit == 1)
    //                    System.out.println("<"+getEnds().get(0).getName()+">");
    //                super.updateState();
    //            }
    //        };
    //        OwnerManager.register(wrt.getSink());
    writers[counter] = wrt.getSink();
    counter++;

    Reader rdr =
        new ContinuousReader(1) {
          @Override
          public void updateState() {
            //                System.out.println("updating ["+getEnds().get(0).getName()+"]");
            //                System.out.println("["+getEnds().get(0).getName()+"/"+limit+"(before
            // update)]");
            if (limit == 1) {
              //                    System.out.println("["+getEnds().get(0).getName()+"]");
              PairwiseAsynchrounous.pending--;
              if (PairwiseAsynchrounous.pending == 0) {
                System.out.print((System.currentTimeMillis() - PairwiseAsynchrounous.start) + ", ");
                if (thread != null) PairwiseAsynchrounous.thread.interrupt();
                //                        OwnerManager.kill();
              }
            }
            super.updateState();
          }

          @Override
          public String toString() {
            return "CReader" + super.toString();
          }
        };

    Replicator r1 = new Replicator();

    wrt.getSink().connect(r1.getSource());
    r1.getSink1().connect(rdr.getSource());

    return r1.getSink2();
  }