package com.sv.service; import com.sv.barcode.ClientConfig; import com.sv.barcode.ListenKeyFrame; import com.sv.netty.ClientThread; import com.sv.netty.config.NettyConstant; import com.sv.netty.utils.JsonUtils; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; /** * 启动socker和websocket服务 * * @author peakren * @date 05/12/2017 10:25 PM */ public class ClientService { public static void main(String[] args) throws IOException, InterruptedException { File file = new File("/home/venue/client/venue.conf"); FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); String line = bufferedReader.readLine(); if (line != null) { ClientConfig decode = JsonUtils.decode(line, ClientConfig.class); System.setProperty(NettyConstant.VENUE_SERVER_IP,decode.getServerIp()); System.setProperty(NettyConstant.VENUE_SERVER_PORT,decode.getServerPort()); System.setProperty(NettyConstant.VENUE_CLIENT_SN,decode.getClientSN()); System.setProperty(NettyConstant.VENUE_CLIENT_VID,decode.getClientVid()); System.setProperty(NettyConstant.VENUE_CHECK_PWD,decode.getClientPwd()); } bufferedReader.close(); fileReader.close(); ClientThread instance = ClientThread.getInstance(); instance.start(); Thread.sleep(10000); ListenKeyFrame listenKeyFrame = new ListenKeyFrame("-加载中12%"); listenKeyFrame.newFrame(); Thread.sleep(3000); listenKeyFrame.close(); ListenKeyFrame listenKeyFrame1 = new ListenKeyFrame("-加载中53%"); listenKeyFrame1.newFrame(); Thread.sleep(3000); listenKeyFrame1.close(); ListenKeyFrame listenKeyFrame2 = new ListenKeyFrame("-加载中94%"); listenKeyFrame2.newFrame(); Thread.sleep(3000); listenKeyFrame2.close(); ListenKeyFrame listenKeyFrame3 = new ListenKeyFrame(""); listenKeyFrame3.newFrame(); listenKeyFrame3.focus(); } }