title: NullPointerException when making XMPP connection through Smack 4.2.0
body: <p>I intend to use Smack to send messages through Firebase CCS. I modified a simple CCS client for my Web App but when I try to make connection, it results in exception.
  I am using <strong>Smack 4.2.0</strong></p>
  
  <p>Here is the process of connection.</p>
  
  <p>1) The connection method which is in my client:</p>
  
  <pre><code>public void connect() throws XMPPException{
          try{
              config = XMPPTCPConnectionConfiguration.builder()
                      .setPort(Config.FCM_PORT)
                      .setHost("fcm-xmpp.googleapis.com")
                      .setXmppDomain("googleapis.com")
                      .setSecurityMode(/*Default; Explicit setting for emphasis*/SecurityMode.ifpossible)
                      .setSendPresence(true)
                      .setUsernameAndPassword(fcmServerUsername, mApiKey)
                      .setSocketFactory(SSLSocketFactory.getDefault())
                      .setDebuggerEnabled(mDebuggable)/* Launch a window with info about packets sent and received */
                      .build();
          }
          catch(XmppStringprepException e){
              e.printStackTrace();
          }
  
          connection = new XMPPTCPConnection(config);
  
  
          // Configuring Automatic reconnection
          ReconnectionManager manager = ReconnectionManager.getInstanceFor(connection);
          manager.setReconnectionPolicy(ReconnectionManager.ReconnectionPolicy.RANDOM_INCREASING_DELAY);
          manager.enableAutomaticReconnection();
  
          // Connect now then login
          try{
              connection.connect();
              connection.login();
          }
          // TODO: Handle the exceptions if possible appropriately
          catch(SmackException sme){
              logger.severe(sme.getMessage());
              sme.printStackTrace();
          }
          catch(IOException ioe){
              logger.severe(ioe.getMessage());
              ioe.printStackTrace();
          }
          catch(InterruptedException ie){
              logger.severe("Connection got interrupted!!");
              ie.printStackTrace();
          }
      }
  </code></pre>
  
  <p>2) I traced the exception and I got it here: (Smack's source)</p>
  
  <p>At the line - <code>HostAddress hostAddress = DNSUtil.getDNSResolver().lookupHostAddress(config.host, config.port, failedAddresses, config.getDnssecMode());</code></p>
  
  <pre><code>// AbstractXMPPConnection.java
  protected List&lt;HostAddress&gt; populateHostAddresses() {
          List&lt;HostAddress&gt; failedAddresses = new LinkedList&lt;&gt;();
          if (config.hostAddress != null) {
              hostAddresses = new ArrayList&lt;&gt;(1);
              HostAddress hostAddress = new HostAddress(config.port, config.hostAddress);
              hostAddresses.add(hostAddress);
          }
          else if (config.host != null) {
              hostAddresses = new ArrayList&lt;HostAddress&gt;(1);
              HostAddress hostAddress = DNSUtil.getDNSResolver().lookupHostAddress(config.host, config.port, failedAddresses, config.getDnssecMode());
              if (hostAddress != null) {
                  hostAddresses.add(hostAddress);
              }
          } else {
              // N.B.: Important to use config.serviceName and not AbstractXMPPConnection.serviceName
              hostAddresses = DNSUtil.resolveXMPPServiceDomain(config.getXMPPServiceDomain().toString(), failedAddresses, config.getDnssecMode());
          }
          // Either the populated host addresses are not empty *or* there must be at least one failed address.
          assert(!hostAddresses.isEmpty() || !failedAddresses.isEmpty());
          return failedAddresses;
      }
  </code></pre>
  
  <p>The exception is <strong>NullPointerException</strong> and I found that <code>getDNSResolver()</code> returns null. Of all the sources I have referenced, there wasn't anything related to DNS resolver as it is supposed to be internally handled by Smack. So my question is, have I missed out some crucial configuration or step in making the connection?</p>
  
  <p><strong>EDIT:</strong> I asked here because Smack is vast lib and there might some config someone knows that I might have missed. I am unable to set DNSResolver directly</p>