// Path: Source/src/de/tum/in/www1/jReto/module/api/Address.java
// public interface Address {
//     /** 
//     * Called to establish a new outgoing connection.
//     * @return A new connection to the peer.
//     */
// 	Connection createConnection();
// 	/** The cost of an address gives an heuristic about which Address should be used if multiple are available. Lower cost is preferred. An WlanAddress uses a cost of 10. */ 
// 	int getCost();
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/module/api/Connection.java
// public interface Connection {
// 	/** 
// 	* The Connection.Handler interface allows the Connection to inform its delegate about various events.
// 	*/
// 	public static interface Handler {
// 	    /** Called when the connection connected successfully.*/
// 		void onConnect(Connection connection);
// 	    /** Called when the connection closes. Has an optional error parameter to indicate issues. (Used to report problems to the user). */
// 		void onClose(Connection connection);
// 	    /** Called when data was received. */
// 		void onDataReceived(Connection connection, ByteBuffer data);
// 	    /** Called for each writeData call, when it is complete. */
// 		void onDataSent(Connection connection);
// 	}
// 	
//     /** Sets the connection's delegate. */
// 	void setHandler(Handler handler);
//     /** The connection's delegate. */
// 	Handler getHandler();
// 	
//     /** Whether this connection is currently connected. */
// 	boolean isConnected();
//     /** Reto sends packets which may vary in size. This property may return an ideal packet size that should be used if possible. */
// 	int getRecommendedPacketSize();
// 	
//     /** Connects the connection. */
// 	void connect();
//     /** Closes the connection. */
// 	void close();
// 	
//     /** Sends data using the connection. */
// 	void writeData(ByteBuffer data);
// }
// 
// Path: Source/test/jReto/util/RunLoop.java
// public class RunLoop implements Executor {
// 	private BlockingQueue<Runnable> queue;
// 	private boolean running;
// 	private boolean executeImmediately;
// 	
// 	public RunLoop(boolean executeImmediately) {
// 		this.queue = new LinkedBlockingQueue<>();
// 		this.running = true;
// 		this.executeImmediately = executeImmediately;
// 	}
// 	
// 	public void execute(Runnable runnable) {
// 		if (this.executeImmediately) {
// 			runnable.run();
// 		} else {
// 			this.queue.add(runnable);
// 		}
// 	}
// 	
// 	public void start() {
// 		while (this.running) {
// 			try {
// 				this.queue.take().run();
// 			} catch (InterruptedException e) {
// 				// TODO Auto-generated catch block
// 				e.printStackTrace();
// 			}
// 		}
// 	}
// 	
// 	public void stop() {
// 		this.queue.add(new Runnable() {
// 			
// 			@Override
// 			public void run() {
// 				RunLoop.this.running = false;
// 			}
// 		});
// 	}
// }


import java.nio.ByteBuffer;
import de.tum.in.www1.jReto.module.api.Address;
import de.tum.in.www1.jReto.module.api.Connection;
import jReto.util.RunLoop;
package jReto.module.dummy;



public class DummyAddress implements Address {
	public static interface DummySocket {
		void write(ByteBuffer data);
		void close();
		void sabotage();
	}
	
	public class ForwardingConnection {
		private DummyConnection inConnection;
		private DummyConnection outConnection;
		private DummyAdvertiser advertiser;
		
// Path: Source/src/de/tum/in/www1/jReto/module/api/Address.java
// public interface Address {
//     /** 
//     * Called to establish a new outgoing connection.
//     * @return A new connection to the peer.
//     */
// 	Connection createConnection();
// 	/** The cost of an address gives an heuristic about which Address should be used if multiple are available. Lower cost is preferred. An WlanAddress uses a cost of 10. */ 
// 	int getCost();
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/module/api/Connection.java
// public interface Connection {
// 	/** 
// 	* The Connection.Handler interface allows the Connection to inform its delegate about various events.
// 	*/
// 	public static interface Handler {
// 	    /** Called when the connection connected successfully.*/
// 		void onConnect(Connection connection);
// 	    /** Called when the connection closes. Has an optional error parameter to indicate issues. (Used to report problems to the user). */
// 		void onClose(Connection connection);
// 	    /** Called when data was received. */
// 		void onDataReceived(Connection connection, ByteBuffer data);
// 	    /** Called for each writeData call, when it is complete. */
// 		void onDataSent(Connection connection);
// 	}
// 	
//     /** Sets the connection's delegate. */
// 	void setHandler(Handler handler);
//     /** The connection's delegate. */
// 	Handler getHandler();
// 	
//     /** Whether this connection is currently connected. */
// 	boolean isConnected();
//     /** Reto sends packets which may vary in size. This property may return an ideal packet size that should be used if possible. */
// 	int getRecommendedPacketSize();
// 	
//     /** Connects the connection. */
// 	void connect();
//     /** Closes the connection. */
// 	void close();
// 	
//     /** Sends data using the connection. */
// 	void writeData(ByteBuffer data);
// }
// 
// Path: Source/test/jReto/util/RunLoop.java
// public class RunLoop implements Executor {
// 	private BlockingQueue<Runnable> queue;
// 	private boolean running;
// 	private boolean executeImmediately;
// 	
// 	public RunLoop(boolean executeImmediately) {
// 		this.queue = new LinkedBlockingQueue<>();
// 		this.running = true;
// 		this.executeImmediately = executeImmediately;
// 	}
// 	
// 	public void execute(Runnable runnable) {
// 		if (this.executeImmediately) {
// 			runnable.run();
// 		} else {
// 			this.queue.add(runnable);
// 		}
// 	}
// 	
// 	public void start() {
// 		while (this.running) {
// 			try {
// 				this.queue.take().run();
// 			} catch (InterruptedException e) {
// 				// TODO Auto-generated catch block
// 				e.printStackTrace();
// 			}
// 		}
// 	}
// 	
// 	public void stop() {
// 		this.queue.add(new Runnable() {
// 			
// 			@Override
// 			public void run() {
// 				RunLoop.this.running = false;
// 			}
// 		});
// 	}
// }


// Path: Source/test/jReto/module/dummy/DummyAddress.java
import java.nio.ByteBuffer;
import de.tum.in.www1.jReto.module.api.Address;
import de.tum.in.www1.jReto.module.api.Connection;
import jReto.util.RunLoop;

package jReto.module.dummy;



public class DummyAddress implements Address {
	public static interface DummySocket {
		void write(ByteBuffer data);
		void close();
		void sabotage();
	}
	
	public class ForwardingConnection {
		private DummyConnection inConnection;
		private DummyConnection outConnection;
		private DummyAdvertiser advertiser;
		
		public ForwardingConnection(final DummyNetworkInterface networkInterface, DummyAdvertiser advertiser, RunLoop runloop) {