func TestParsingDelegationMessage(t *testing.T) {
	packetStr := `<message to='service.localhost' from='localhost'>
 <delegation xmlns='urn:xmpp:delegation:1'>
  <delegated namespace='http://jabber.org/protocol/pubsub'/>
 </delegation>
</message>`
	var msg Message
	data := []byte(packetStr)
	if err := xml.Unmarshal(data, &msg); err != nil {
		t.Errorf("Unmarshal(%s) returned error", data)
	}
	var nsDelegated string
	for _, ext := range msg.Extensions {
		if delegation, ok := ext.(*Delegation); ok {
			nsDelegated = delegation.Delegated.Namespace
		}
	}
	if nsDelegated != "http://jabber.org/protocol/pubsub" {
		t.Errorf("Could not find delegated namespace in delegation: %#v\n", msg)
	}
}
We should be able to properly parse delegation confirmation messages
package stanza
import (
	"encoding/xml"
	"testing"
)