testhelper

package
v0.0.0-...-63bff7e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2018 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DELIM = '\n' // 分隔符。
)

Variables

This section is empty.

Functions

func NewTCPComm

func NewTCPComm(addr string) loadgenlib.Caller

NewTCPComm 会新建一个TCP通讯器。

Types

type ServerReq

type ServerReq struct {
	ID       int64
	Operands []int
	Operator string
}

ServerReq 表示服务器请求的结构。

type ServerResp

type ServerResp struct {
	ID      int64
	Formula string
	Result  int
	Err     error
}

ServerResp 表示服务器响应的结构。

type TCPComm

type TCPComm struct {
	// contains filtered or unexported fields
}

TCPComm 表示TCP通讯器的结构。

func (*TCPComm) BuildReq

func (comm *TCPComm) BuildReq() loadgenlib.RawReq

BuildReq 会构建一个请求。

func (*TCPComm) Call

func (comm *TCPComm) Call(req []byte, timeoutNS time.Duration) ([]byte, error)

Call 会发起一次通讯。

func (*TCPComm) CheckResp

func (comm *TCPComm) CheckResp(
	rawReq loadgenlib.RawReq, rawResp loadgenlib.RawResp) *loadgenlib.CallResult

CheckResp 会检查响应内容。

type TCPServer

type TCPServer struct {
	// contains filtered or unexported fields
}

TCPServer 表示基于TCP协议的服务器。

func NewTCPServer

func NewTCPServer() *TCPServer

NewTCPServer 会新建一个基于TCP协议的服务器。

func (*TCPServer) Close

func (server *TCPServer) Close() bool

Close 会关闭服务器。

func (*TCPServer) Listen

func (server *TCPServer) Listen(addr string) error

Listen 会启动对指定网络地址的监听。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL