Examples of UDPServerCollector


Examples of org.jsmdr.collector.UDPServerCollector

    Document doc = XMLUtil.createEmptyDocment();
    Element elt = doc.createElement("Collector");
    elt.setAttribute("address", "localhost");
    elt.setAttribute("port", "10000");
   
    UDPServerCollector collector = new UDPServerCollector(elt);
    assertTrue(collector.isRunning());
    collector.addListener(this);
   
    // Send a packet
    line = null;
    String test = "This is a test";
    byte[] testBytes = test.getBytes("UTF-8");
    DatagramPacket request = new DatagramPacket(testBytes, testBytes.length, InetAddress.getLocalHost(), 10000);
        DatagramSocket socket = new DatagramSocket();
        socket.send(request);
        try {
      Thread.sleep(500);
    } catch (InterruptedException e) {}
       
        assertEquals(line, test);
        collector.close();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.