How to retrieve an IQ response

I am trying to automate some xmpp server tests. I send a xml stanza to xmpp server and verify the response. I can successfully send the stanza but I am having trouble retrieving the response.

I am using Smack 4.1.8 api.

This is the stanza that I am sending:

<iq id='123' from='rmorgan@xmppserver.domain.net' to='sandbox@xmppserver.domain.net/resource' type='get'> <control xmlns='http://domain.com/powertalk/control/2.0'> <point id='00000000/relay_1A' /> <point id='00000000/relay_2A' /> </control> </iq>

When I send this using PSI client I get the following in return:

<iq from="sandbox@xmppserver.domain/resource" type="result" to="rmorgan@xmppserver.domain/resource" id="17"> <control xmlns="http://domain.com/powertalk/control/2.0"> <point val="0" id="00000000/relay_1A" ts="2016-08-30T15:52:41.068308Z"/> <point val="0" id="00000000/relay_2A" ts="2016-08-30T15:52:41.148337Z"/> </control> </iq>

That is what I want to retrieve.

What I actually receive is:

<iq to='rmorgan@xmppserver.domain.net/resource' from='rmorgan@xmppserver.domain.net' id='c8QbM-8' type='result'> <query xmlns='jabber:iq:roster'></query> </iq>

Here is my code. I think I have to do some sort of custom IQ provider but the examples I’m finding are mostly for Smack 3.x and are not valid.

` AbstractXMPPConnection mConnection = this.getConnection();
try
{
final IQ iq = new IQ(“control”,“http://domain.com/powertalk/control/2.0”)
{
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml)
{
xml.rightAngleBracket();
xml.halfOpenElement(“point”);
xml.attribute(“id”, “00000000/relay_1A”);
xml.append(" />");
xml.halfOpenElement(“point”);
xml.attribute(“id”, “00000000/relay_2A”);
xml.append(" />");

return xml;
}
};
iq.setStanzaId(“123”);
iq.setFrom("rmorgan@xmppserver.domain.net");
iq.setType(IQ.Type.get);
iq.setTo("sandbox@xmppserver.domain.net/resource");
mConnection.sendStanza(iq);

// Receive the packet
IQ iqReceived = (IQ)collector.nextResult(50000);

// Stop queuing results
collector.cancel();

System.out.println("Sent: " + iq.toXML());
System.out.println("Received: " + iqReceived.toXML());
System.out.println("Collector size = " + collector.getCollectedCount()); //returns 0
System.out.println("collector pollResult = " + collector.pollResult()); //returns null
System.out.println("collector StanzaFilter = " + collector.getStanzaFilter()); //returns: StanzaIdFilter: id=123
}
catch (Exception e)
{
e.printStackTrace();
}

}`

can someone tell me what I am missing here?