You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: amf_test.go
    path of file: ./repos/livego/protocol/amf
    
    the code of the file until where you have to start completion: package amf

import (
	"bytes"
	"fmt"
	"reflect"
	"testing"
	"time"
)

func EncodeAndDecode(val interface{}, ver Version) (result interface{}, err error) {
    
func EncodeAndDecode(val interface{}, ver Version) (result interface{}, err error) {
	enc := new(Encoder)
	dec := new(Decoder)

	buf := new(bytes.Buffer)

	_, err = enc.Encode(buf, val, ver)
	if err != nil {
		return nil, fmt.Errorf("error in encode: %s", err)
	}

	result, err = dec.Decode(buf, ver)
	if err != nil {
		return nil, fmt.Errorf("error in decode: %s", err)
	}

	return
}