title: Android - Unable to setup connection
body: <p>This is the error that I am getting while building the app</p>
  
  <blockquote>
    <p>java.lang.NullPointerException: cancel() called with a null PendingIntent
            at android.app.AlarmManager.cancel(AlarmManager.java:901)
            at org.eclipse.paho.android.service.AlarmPingSender.stop(AlarmPingSender.java:86)
            at org.eclipse.paho.client.mqttv3.internal.ClientComms.shutdownConnection(ClientComms.java:327)
            at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:608)
            at java.lang.Thread.run(Thread.java:764)</p>
  </blockquote>
  
  <p>Part of the code that is giving this error is </p>
  
  <pre><code>try {
                      client = new MqttAndroidClient(getApplicationContext(), "ssl://192.168.43.112:1883", clientId);
                      InputStream input = getApplicationContext().getResources().openRawResource(R.raw.mynewkeystore);
                      options = new MqttConnectOptions();
                      options.setSocketFactory(client.getSSLSocketFactory(input,"password"));
                      IMqttToken token = client.connect(options);
                      token.setActionCallback(new IMqttActionListener() {
                          @Override
                          public void onSuccess(IMqttToken asyncActionToken) {
                              //Log.d("Connection", "Connected to Broker ");
                              //Toast.makeText(getApplicationContext(),"ConnectiontoMQTTBrokerMade", Toast.LENGTH_SHORT).show();
                              pubConnect.setVisibility(View.INVISIBLE);
                              pubDisconnect.setVisibility(View.VISIBLE);
                              pubPub.setVisibility(View.VISIBLE);
                              ipinputpublish.setVisibility(View.INVISIBLE);
                              messagemqtt.setVisibility(View.VISIBLE);
                          }
  
                          @Override
                          public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
                             // Toast.makeText(getApplicationContext(),"ConnectiontoMQTTBrokerRejected", Toast.LENGTH_SHORT).show();
                              Toast.makeText(getApplicationContext(), exception.getMessage(), Toast.LENGTH_LONG).show();
                              Log.d("Connection", "Unable to connect to Broker");
                          }
                      });
                  } catch (Exception e) {
                      e.printStackTrace();
                      Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
                  }
  </code></pre>
  
  <p>I am unable to figure out why this error is being generated. Can someone please help me out here ?</p>