code: func NewCONNECT(opts *CONNECTOptions) (Packet, error) {
  	// Initialize the options.
  	if opts == nil {
  		opts = &CONNECTOptions{}
  	}
  
  	// Validate the options.
  	if err := opts.validate(); err != nil {
  		return nil, err
  	}
  
  	// Create a CONNECT Packet.
  	p := &CONNECT{
  		clientID:     opts.ClientID,
  		userName:     opts.UserName,
  		password:     opts.Password,
  		cleanSession: opts.CleanSession,
  		keepAlive:    opts.KeepAlive,
  		willTopic:    opts.WillTopic,
  		willMessage:  opts.WillMessage,
  		willQoS:      opts.WillQoS,
  		willRetain:   opts.WillRetain,
  	}
  
  	// Set the variable header to the Packet.
  	p.setVariableHeader()
  
  	// Set the payload to the Packet.
  	p.setPayload()
  
  	// Set the fixed header to the packet.
  	p.setFixedHeader()
  
  	// Return the Packet.
  	return p, nil
  }
docs: // NewCONNECT creates and returns a CONNECT Packet.