// Path: src/main/java/net/gcdc/UdpDuplicator.java
// public class UdpDuplicator {
// 
//     private  static final  Logger LOGGER = LoggerFactory.getLogger(UdpDuplicator.class);
// 
//     private class Client implements Runnable {
//         public final int            localPort;
//         public final SocketAddress  remoteAddress;
//         public final DatagramSocket socket;
// 
//         public Client(int localPort, SocketAddress remoteAddress) throws SocketException {
//             this.localPort = localPort;
//             this.remoteAddress = remoteAddress;
//             this.socket = new DatagramSocket(this.localPort);
//         }
// 
//         public void send(byte[] payload) throws IOException {
//             socket.send(new DatagramPacket(payload, payload.length, remoteAddress));
//         }
// 
//         @Override
//         public void run() {
//             int length = 3000;
//             byte[] buffer = new byte[length];
//             DatagramPacket packet = new DatagramPacket(buffer, length);
//             try {
//                 while (true) {
//                     socket.receive(packet);
//                     byte[] payload = Arrays.copyOfRange(packet.getData(), 0, packet.getLength());
//                     sendAll(payload);
//                 }
//             } catch (IOException e) {
//                 // TODO Auto-generated catch block
//                LOGGER.info("packetsending or receiving error ", e);
//             }
//         }
//     }
// 
//     private final ArrayList<Client> clients = new ArrayList<>();
// 
//     public UdpDuplicator() {
//     }
// 
//     public void sendAll(byte[] payload) throws IOException {
//         for (Client c : clients) {
//             c.send(payload);
//         }
//     }
// 
//     public void add(int localPort, SocketAddress remoteAddress) throws SocketException {
//         Client c = new Client(localPort, remoteAddress);
//         (new Thread(c)).start();
//         clients.add(c);
//     }
// }


import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.gcdc.UdpDuplicator;
import org.junit.Test;
package net.gcdc.geonetworking;





public class UdpDuplicatorTest {

    @Test(timeout=3000)
    public void test() throws IOException, InterruptedException {
// Path: src/main/java/net/gcdc/UdpDuplicator.java
// public class UdpDuplicator {
// 
//     private  static final  Logger LOGGER = LoggerFactory.getLogger(UdpDuplicator.class);
// 
//     private class Client implements Runnable {
//         public final int            localPort;
//         public final SocketAddress  remoteAddress;
//         public final DatagramSocket socket;
// 
//         public Client(int localPort, SocketAddress remoteAddress) throws SocketException {
//             this.localPort = localPort;
//             this.remoteAddress = remoteAddress;
//             this.socket = new DatagramSocket(this.localPort);
//         }
// 
//         public void send(byte[] payload) throws IOException {
//             socket.send(new DatagramPacket(payload, payload.length, remoteAddress));
//         }
// 
//         @Override
//         public void run() {
//             int length = 3000;
//             byte[] buffer = new byte[length];
//             DatagramPacket packet = new DatagramPacket(buffer, length);
//             try {
//                 while (true) {
//                     socket.receive(packet);
//                     byte[] payload = Arrays.copyOfRange(packet.getData(), 0, packet.getLength());
//                     sendAll(payload);
//                 }
//             } catch (IOException e) {
//                 // TODO Auto-generated catch block
//                LOGGER.info("packetsending or receiving error ", e);
//             }
//         }
//     }
// 
//     private final ArrayList<Client> clients = new ArrayList<>();
// 
//     public UdpDuplicator() {
//     }
// 
//     public void sendAll(byte[] payload) throws IOException {
//         for (Client c : clients) {
//             c.send(payload);
//         }
//     }
// 
//     public void add(int localPort, SocketAddress remoteAddress) throws SocketException {
//         Client c = new Client(localPort, remoteAddress);
//         (new Thread(c)).start();
//         clients.add(c);
//     }
// }


// Path: src/test/java/net/gcdc/geonetworking/UdpDuplicatorTest.java
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.gcdc.UdpDuplicator;
import org.junit.Test;

package net.gcdc.geonetworking;





public class UdpDuplicatorTest {

    @Test(timeout=3000)
    public void test() throws IOException, InterruptedException {
        UdpDuplicator d = new UdpDuplicator();