// Path: com/raphfrk/protocol/KillableThread.java
// public class KillableThread extends Thread {
// 
// 	private ArrayList<KillableThread> children = new ArrayList<KillableThread>();
// 
// 	private boolean killed = false;
// 
// 	public boolean killed() {
// 		if(Thread.interrupted()) {
// 			kill();
// 		}
// 
// 		return killed;
// 	}
// 
// 	protected void kill() {
// 		for(Thread t : children) {
// 			t.interrupt();
// 		}
// 		killed = true;
// 	}
// 
// 	protected void revive() {
// 		Thread.interrupted();
// 		killed = false;
// 	}
// 	
// 	boolean joinAll(int delay) throws InterruptedException {
// 		kill();
// 		for(Thread t : children) {
// 			t.join(delay);
// 			if(t.isAlive()) {
// 				return false;
// 			}
// 		}
// 		
// 		return true;
// 	}
// 
// }


import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantLock;
import com.raphfrk.protocol.KillableThread;

		clearFlush();

		lock.lock();
		try {
			//System.out.println("Flush happening " + System.currentTimeMillis());
			super.flush();
		} finally {
			lock.unlock();
		}
	}

	public void close() throws IOException {

		while(timer.isAlive()) {
			timer.interrupt();
			try {
				timer.join(50);
			} catch (InterruptedException ie) {
				try {
					Thread.currentThread().interrupt();
					Thread.sleep(50);
				} catch (InterruptedException ie2) {
					Thread.currentThread().interrupt();
				}
			}

		}

	}


// Path: com/raphfrk/protocol/KillableThread.java
// public class KillableThread extends Thread {
// 
// 	private ArrayList<KillableThread> children = new ArrayList<KillableThread>();
// 
// 	private boolean killed = false;
// 
// 	public boolean killed() {
// 		if(Thread.interrupted()) {
// 			kill();
// 		}
// 
// 		return killed;
// 	}
// 
// 	protected void kill() {
// 		for(Thread t : children) {
// 			t.interrupt();
// 		}
// 		killed = true;
// 	}
// 
// 	protected void revive() {
// 		Thread.interrupted();
// 		killed = false;
// 	}
// 	
// 	boolean joinAll(int delay) throws InterruptedException {
// 		kill();
// 		for(Thread t : children) {
// 			t.join(delay);
// 			if(t.isAlive()) {
// 				return false;
// 			}
// 		}
// 		
// 		return true;
// 	}
// 
// }


// Path: com/raphfrk/netutil/MaxLatencyBufferedOutputStream.java
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantLock;
import com.raphfrk.protocol.KillableThread;

		clearFlush();

		lock.lock();
		try {
			//System.out.println("Flush happening " + System.currentTimeMillis());
			super.flush();
		} finally {
			lock.unlock();
		}
	}

	public void close() throws IOException {

		while(timer.isAlive()) {
			timer.interrupt();
			try {
				timer.join(50);
			} catch (InterruptedException ie) {
				try {
					Thread.currentThread().interrupt();
					Thread.sleep(50);
				} catch (InterruptedException ie2) {
					Thread.currentThread().interrupt();
				}
			}

		}

	}


	private class LocalTimer extends KillableThread {
