code: func (c *Connection) connectHandler(h Headers) (e error) {
  	//fmt.Printf("CHDB01\n")
  	c.rdr = bufio.NewReader(c.netconn)
  	b, e := c.rdr.ReadBytes(0)
  	if e != nil {
  		return e
  	}
  	//fmt.Printf("CHDB02\n")
  	f, e := connectResponse(string(b))
  	if e != nil {
  		return e
  	}
  	//fmt.Printf("CHDB03\n")
  	//
  	c.ConnectResponse = &Message{f.Command, f.Headers, f.Body}
  	if c.ConnectResponse.Command == ERROR {
  		return &CONNERROR{ECONERR, string(f.Body)}
  	}
  	//fmt.Printf("CHDB04\n")
  	//
  	e = c.setProtocolLevel(h, c.ConnectResponse.Headers)
  	if e != nil {
  		return e
  	}
  	//fmt.Printf("CHDB05\n")
  	//
  	if s, ok := c.ConnectResponse.Headers.Contains(HK_SESSION); ok {
  		c.sessLock.Lock()
  		c.session = s
  		c.sessLock.Unlock()
  	}
  
  	if c.Protocol() >= SPL_11 {
  		e = c.initializeHeartBeats(h)
  		if e != nil {
  			return e
  		}
  	}
  	//fmt.Printf("CHDB06\n")
  
  	c.connected = true
  	c.mets.tfr += 1
  	c.mets.tbr += c.ConnectResponse.Size(false)
  	return nil
  }
docs: /*
  	Connection handler, one time use during initial connect.
  
  	Handle broker response, react to version incompatabilities, set up session,
  	and if necessary initialize heart beats.
  */