implement Encode (for test) and fix buf for header table max size changing