protected void subscribe(){
  if (sampleClientSub == null) {
    try {
      sampleClientSub=new SampleAsyncCallback(url,clientIdSub,cleanSession,quietMode,userName,password);
    }
 catch (    MqttException e) {
      e.printStackTrace();
    }
  }
  if (sampleClientSub != null) {
    String topic="Sample/#";
    int qos=2;
    try {
      sampleClientSub.subscribe(topic,qos);
    }
 catch (    Throwable e) {
      e.printStackTrace();
    }
  }
}

protected void subscribe ( ) { if ( sampleClientSub == null ) { try { sampleClientSub = new SampleAsyncCallback ( url , clientIdSub , cleanSession , quietMode , userName , password ) ; } catch ( MqttException e ) { e . printStackTrace ( ) ; } } if ( sampleClientSub != null ) { String topic = "Sample/#" ; int qos = 2 ; try { sampleClientSub . subscribe ( topic , qos ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } } }
subscribe to a topic on an mqtt server once subscribed this method waits for the messages to arrive from the server that match the subscription . it continues listening for messages until pin 3 is pressed
