func encodeLength(n uint32) uint32 {
	var value, digit uint32
	for n > 0 {
		if value != 0 {
			value <<= 8
		}
		digit = n % 128
		n /= 128
		if n > 0 {
			digit |= 0x80
		}
		value |= digit
	}
	return value
}
encodeLength encodes the unsigned integer
by using a variable length encoding scheme.
package packet
func encodeUint16(n uint16) []byte {
	return []byte{byte(n >> 8), byte(n)}
}