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: rpc_test.go
    path of file: ./repos/mole/rpc
    
    the code of the file until where you have to start completion: package rpc_test

import (
	"context"
	"encoding/json"
	"fmt"
	"net"
	"os"
	"testing"

	"github.com/davrodpin/mole/rpc"
)

var (
	addr net.Addr
)

func TestHandler(t *testing.T) {
	responseTemplate := `{"message":"%s"}`
	method := "test"
	paramValue := "param"
	expectedResponse := fmt.Sprintf(responseTemplate, paramValue)

	rpc.Register(method, func(params interface{}) (json.RawMessage, error) {
		var r []uint8
		var ok bool

		if r, ok = params.([]u
    
func TestMethodWithError(t *testing.T) {
	method := "testwitherror"
	expectedResponse := fmt.Sprintf(`{"code":-32603,"data":null,"message":"error executing rpc method %s"}`, method)

	rpc.Register(method, func(params interface{}) (json.RawMessage, error) {
		return nil, fmt.Errorf("error")
	})

	response, err := rpc.Call(context.Background(), addr.String(), method, "param")
	if err != nil {
		t.Errorf("error while calling remote procedure: %v", err)
	}

	json, err := json.Marshal(response)
	if err != nil {
		t.Errorf("error while parsing response to string: response: %s, err: %v", response, err)
	}

	if expectedResponse != string(json) {
		t.Errorf("unexpected response for remote procedure call: want: %s, got: %s", expectedResponse, string(json))
	}
}