func getRawCallFrames()

in benchmark/frame_templates.go [93:133]


func getRawCallFrames(timeout time.Duration, svcName string, reqSize int) frames {
	var fs frames
	modifier := func(fromClient bool, f *tchannel.Frame) *tchannel.Frame {
		buf := &bytes.Buffer{}
		if err := f.WriteOut(buf); err != nil {
			panic(err)
		}

		if fromClient {
			fs.outgoing = append(fs.outgoing, buf.Bytes())
		} else {
			fs.incoming = append(fs.incoming, buf.Bytes())
		}

		return f
	}

	withNewServerClient(svcName, func(server, client *tchannel.Channel) {
		testutils.RegisterEcho(server, nil)

		relay, err := NewTCPFrameRelay([]string{server.PeerInfo().HostPort}, modifier)
		if err != nil {
			panic(err)
		}
		defer relay.Close()

		args := &raw.Args{
			Arg2: getRequestBytes(reqSize),
			Arg3: getRequestBytes(reqSize),
		}

		ctx, cancel := tchannel.NewContext(timeout)
		defer cancel()

		if _, _, _, err := raw.Call(ctx, client, relay.HostPort(), svcName, "echo", args.Arg2, args.Arg3); err != nil {
			panic(err)
		}
	})

	return fs
}