@@ -0,0 +1,1817 @@
+package test.server;%0A%0Aimport org.eclipse.paho.client.mqttv3.MqttClient;%0Aimport org.eclipse.paho.client.mqttv3.MqttConnectOptions;%0Aimport org.eclipse.paho.client.mqttv3.MqttException;%0Aimport org.eclipse.paho.client.mqttv3.MqttMessage;%0Aimport org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;%0A%0Apublic class MqttPublishSample %7B%0A%09%0A    public static void main(String%5B%5D args) %7B%0A%0A        String topic        = %22MQTT Examples%22;%0A        String content      = %22Message from MqttPublishSample%22;%0A        int qos             = 2;%0A        String broker       = %22tcp://localhost:1991%22;%0A        String clientId     = %22JavaSample%22;%0A        MemoryPersistence persistence = new MemoryPersistence();%0A%0A        try %7B%0A            MqttClient sampleClient = new MqttClient(broker, clientId, persistence);%0A            MqttConnectOptions connOpts = new MqttConnectOptions();%0A            connOpts.setCleanSession(true);%0A            System.out.println(%22Connecting to broker: %22+broker);%0A            sampleClient.connect(connOpts);%0A            System.out.println(%22Connected%22);%0A            System.out.println(%22Publishing message: %22+content);%0A            MqttMessage message = new MqttMessage(content.getBytes());%0A            message.setQos(qos);%0A            sampleClient.publish(topic, message);%0A            System.out.println(%22Message published%22);%0A            sampleClient.disconnect();%0A            System.out.println(%22Disconnected%22);%0A            System.exit(0);%0A        %7D catch(MqttException me) %7B%0A            System.out.println(%22reason %22+me.getReasonCode());%0A            System.out.println(%22msg %22+me.getMessage());%0A            System.out.println(%22loc %22+me.getLocalizedMessage());%0A            System.out.println(%22cause %22+me.getCause());%0A            System.out.println(%22excep %22+me);%0A            me.printStackTrace();%0A        %7D%0A    %7D%0A    %0A%7D%0A

Update test code.