@Test public void testGetInstance() throws Exception { MqttUploader uploader = MqttUploader.getInstance(); DataDefinition.MeterEntry.Builder entryBuilder = DataDefinition.MeterEntry.newBuilder() .setMeterBgMgdl(120); DataDefinition.MeterEntry entry = entryBuilder.build(); DataDefinition.G4Download.Builder frameBuilder = DataDefinition.G4Download.newBuilder() .setDownloadTimestamp(getTime()) .setDownloadStatus(DataDefinition.DownloadStatus.SUCCESS) .addMeter(entry); DataDefinition.G4Download frame = frameBuilder.build(); uploader.publishMessage(frame.toByteArray()); uploader.disconnect(); }
public static MqttUploader getInstance() throws MqttException { if (instance == null) { synchronized (MqttUploader.class) { if (instance == null) { instance = new MqttUploader(); } } } return instance; }
MqttUploader { public static MqttUploader getInstance() throws MqttException { if (instance == null) { synchronized (MqttUploader.class) { if (instance == null) { instance = new MqttUploader(); } } } return instance; } }
MqttUploader { public static MqttUploader getInstance() throws MqttException { if (instance == null) { synchronized (MqttUploader.class) { if (instance == null) { instance = new MqttUploader(); } } } return instance; } protected  MqttUploader(); }
MqttUploader { public static MqttUploader getInstance() throws MqttException { if (instance == null) { synchronized (MqttUploader.class) { if (instance == null) { instance = new MqttUploader(); } } } return instance; } protected  MqttUploader(); static MqttUploader getInstance(); void publishMessage(byte[] data); void disconnect(); }
MqttUploader { public static MqttUploader getInstance() throws MqttException { if (instance == null) { synchronized (MqttUploader.class) { if (instance == null) { instance = new MqttUploader(); } } } return instance; } protected  MqttUploader(); static MqttUploader getInstance(); void publishMessage(byte[] data); void disconnect();  }