import wei.yigulu.iec104.nettyconfig.Iec104SlaverBuilder;

import java.util.Random;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

/**
 * @author: xiuwei
 * @version:
 */
public class SlaveTest1 {


    public static void main(String[] args) throws Exception {
        ScheduledExecutorService ex = Executors.newScheduledThreadPool(2);
        Random r = new Random();
        Iec104SlaverBuilder slaverBuilder = new Iec104SlaverBuilder(2404);
        slaverBuilder.createByUnBlock();
        Thread.sleep(3000);
        for (; ; ) {
            System.out.println("关闭通道");
            slaverBuilder.stop();
            Thread.sleep(r.nextInt(5)*100000);
            slaverBuilder = new Iec104SlaverBuilder(2404);
            slaverBuilder.createByUnBlock();
            Thread.sleep(r.nextInt(5) * 1000);
        }


    }


}
