Search in sources :

Example 6 with HttpOverXmppReq

use of org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq in project Smack by igniterealtime.

the class AbstractHttpOverXmppProviderTest method areReqHeadersParsedCorrectly.

@Test
public void areReqHeadersParsedCorrectly() throws Exception {
    String string = "<req xmlns='urn:xmpp:http' method='GET' resource='/rdf/xep' version='1.1'>" + "<headers xmlns='http://jabber.org/protocol/shim'>" + "<header name='Host'>clayster.com</header>" + "</headers>" + "</req>";
    Map<String, String> expectedHeaders = new HashMap<String, String>();
    expectedHeaders.put("Host", "clayster.com");
    HttpOverXmppReqProvider provider = new HttpOverXmppReqProvider();
    XmlPullParser parser = PacketParserUtils.getParserFor(string);
    IQ iq = provider.parse(parser);
    assertTrue(iq instanceof HttpOverXmppReq);
    HttpOverXmppReq body = ((HttpOverXmppReq) iq);
    checkHeaders(body.getHeaders(), expectedHeaders);
}
Also used : HashMap(java.util.HashMap) XmlPullParser(org.xmlpull.v1.XmlPullParser) IQ(org.jivesoftware.smack.packet.IQ) HttpOverXmppReq(org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq) Test(org.junit.Test)

Aggregations

HttpOverXmppReq (org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq)6 Test (org.junit.Test)5 IQ (org.jivesoftware.smack.packet.IQ)2 XmlPullParser (org.xmlpull.v1.XmlPullParser)2 HashMap (java.util.HashMap)1