good morning!!!!

Skip to content
Snippets Groups Projects
testing.go 474 B
Newer Older
a's avatar
ok
a committed
package websocket

import (
	"context"
	"net/http/httptest"

	"gfx.cafe/open/jrpc/pkg/jrpctest"
a's avatar
a committed
	"gfx.cafe/open/jrpc/pkg/jsonrpc"
a's avatar
ok
a committed
	"gfx.cafe/open/jrpc/pkg/server"
)

func ServerMaker() (*server.Server, jrpctest.ClientMaker, func()) {
	s := jrpctest.NewServer()
	hsrv := httptest.NewServer(&Server{Server: s})
a's avatar
a committed
	return s, func() jsonrpc.Conn {
a's avatar
ok
a committed
		conn, err := DialWebsocket(context.Background(), hsrv.URL, "")
		if err != nil {
			panic(err)
		}
		return conn
	}, hsrv.Close
}