test

package
v0.0.0-...-1397d36 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2016 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnHelper

type ConnHelper struct {
	Conn *neptulon.Conn
	// contains filtered or unexported fields
}

ConnHelper is a Neptulon Conn wrapper for testing. All the functions are wrapped with proper test runner error logging.

func NewConnHelper

func NewConnHelper(t *testing.T, addr string) *ConnHelper

NewConnHelper creates a new client helper object.

func (*ConnHelper) CloseWait

func (ch *ConnHelper) CloseWait()

CloseWait closes a connection. Waits till all the goroutines handling messages quit.

func (*ConnHelper) Connect

func (ch *ConnHelper) Connect() *ConnHelper

Connect connects to a server.

func (*ConnHelper) SendRequestSync

func (ch *ConnHelper) SendRequestSync(method string, params interface{}, resHandler func(ctx *neptulon.ResCtx) error) *ConnHelper

SendRequestSync sends a JSON-RPC request through the client connection with an auto generated request ID. resHandler is called when a response is returned. This function is synchronous and blocking.

type ServerHelper

type ServerHelper struct {
	Server *neptulon.Server

	// PEM encoded X.509 certificate and private key pairs, if TLS server is used
	RootCACert,
	RootCAKey,
	IntCACert,
	IntCAKey,
	ServerCert,
	ServerKey []byte
	Address string
	// contains filtered or unexported fields
}

ServerHelper is a Neptulon Server wrapper for testing. All the functions are wrapped with proper test runner error logging.

func NewServerHelper

func NewServerHelper(t *testing.T) *ServerHelper

NewServerHelper creates a new server helper object.

func (*ServerHelper) CloseWait

func (sh *ServerHelper) CloseWait()

CloseWait stops the server listener and connections. Waits for all the goroutines handling the client connection to quit.

func (*ServerHelper) GetConnHelper

func (sh *ServerHelper) GetConnHelper() *ConnHelper

GetConnHelper creates a client connection to this server instance and returns the connection wrapped in a ClientHelper.

func (*ServerHelper) ListenAndServe

func (sh *ServerHelper) ListenAndServe() *ServerHelper

ListenAndServe starts the server.

func (*ServerHelper) UseTLS

func (sh *ServerHelper) UseTLS() *ServerHelper

UseTLS enables Transport Layer Security for the connections.

Jump to

Keyboard shortcuts

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