package com.k13n.lt_codes;

public final class ErasureChannel {
  private final double erasureProbability;

  public static final byte[] ERASED = new byte[0];

  public ErasureChannel(double erasureProbability) {
    this.erasureProbability = erasureProbability;
  }

  public byte[] transmit(byte[] data)
  {
    if(Math.random() <= erasureProbability)
    {
      return ERASED;
    }
    else
      return data;
  }
}

@@ -61,101 +61,179 @@
 l %7B%0A
+%0A
   p
-rivate final double erasureProbability;%0A%0A  public static final byte%5B%5D ERASED = new byte%5B0%5D
+ublic interface Callback %7B%0A    public void call(ErasureChannel channel, byte%5B%5D data);%0A  %7D%0A%0A  private final Callback callback;%0A  private final double erasureProbability
 ;%0A%0A 
@@ -255,16 +255,35 @@
 Channel(
+Callback callback, 
 double e
@@ -303,16 +303,46 @@
 lity) %7B%0A
+    this.callback = callback;%0A
     this
@@ -397,22 +397,20 @@
  public 
-byte%5B%5D
+void
  transmi
@@ -423,18 +423,16 @@
 %5B%5D data)
-%0A 
  %7B%0A    i
@@ -432,16 +432,17 @@
 %7B%0A    if
+ 
 (Math.ra
@@ -452,10 +452,9 @@
 m() 
-%3C=
+%3E
  era
@@ -478,67 +478,40 @@
     
-%7B%0A      return ERASED;%0A    %7D%0A    else%0A      return
+  callback.call(this,
  data
+)
 ;%0A  %7D%0A
+%0A
 %7D%0A

Change the ErasureChannel to fire a callback on packet transmission