func (s *Session) init() {
	s.Features = s.extractStreamFeatures()
}
init gathers information on the session such as stream features from the server.
package xmpp
import (
	"encoding/xml"
	"errors"
	"fmt"
	"gosrc.io/xmpp/stanza"
	"strconv"
)
type Session struct {
	BindJid      string  
	StreamId     string
	SMState      SMState
	Features     stanza.StreamFeatures
	TlsEnabled   bool
	lastPacketId int
	transport Transport
	err error
}
func NewSession(c *Client, state SMState) (*Session, error) {
	var s *Session
	if c.Session == nil {
		s = new(Session)
		s.transport = c.transport
		s.SMState = state
		s.init()
	} else {
		s = c.Session
		s.init()
	}
	if s.err != nil {
		return nil, NewConnError(s.err, true)
	}
	if !c.transport.IsSecure() {
		s.startTlsIfSupported(c.config)
	}
	if !c.transport.IsSecure() && !c.config.Insecure {
		err := fmt.Errorf("failed to negotiate TLS session : %s", s.err)
		return nil, NewConnError(err, true)
	}
	if s.TlsEnabled {
		s.reset()
	}
	s.auth(c.config)
	if s.err != nil {
		return s, s.err
	}
	s.reset()
	if s.err != nil {
		return s, s.err
	}
	if s.resume(c.config) {
		return s, s.err
	}
	s.bind(c.config)
	if s.err != nil {
		return s, s.err
	}
	s.rfc3921Session()
	if s.err != nil {
		return s, s.err
	}
	s.EnableStreamManagement(c.config)
	if s.err != nil {
		return s, s.err
	}
	return s, s.err
}
func (s *Session) PacketId() string {
	s.lastPacketId++
	return fmt.Sprintf("%x", s.lastPacketId)
}