mirror of
https://github.com/sourcegraph/jsonrpc2.git
synced 2026-06-18 13:10:02 +02:00
Expose NoopHandler
This commit is contained in:
parent
c9c77b6bb9
commit
e8229febb0
5 changed files with 14 additions and 12 deletions
|
|
@ -265,7 +265,7 @@ func TestHandlerBlocking(t *testing.T) {
|
|||
wg.Done()
|
||||
})
|
||||
connA := jsonrpc2.NewConn(ctx, jsonrpc2.NewBufferedStream(a, jsonrpc2.VSCodeObjectCodec{}), handler)
|
||||
connB := jsonrpc2.NewConn(ctx, jsonrpc2.NewBufferedStream(b, jsonrpc2.VSCodeObjectCodec{}), noopHandler{})
|
||||
connB := jsonrpc2.NewConn(ctx, jsonrpc2.NewBufferedStream(b, jsonrpc2.VSCodeObjectCodec{}), jsonrpc2.NoopHandler{})
|
||||
defer connA.Close()
|
||||
defer connB.Close()
|
||||
|
||||
|
|
@ -287,10 +287,6 @@ func TestHandlerBlocking(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
type noopHandler struct{}
|
||||
|
||||
func (noopHandler) Handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.Request) {}
|
||||
|
||||
type readWriteCloser struct {
|
||||
read, write func(p []byte) (n int, err error)
|
||||
}
|
||||
|
|
@ -348,7 +344,7 @@ func TestConn_DisconnectNotify_Close_async(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestConn_Close_waitingForResponse(t *testing.T) {
|
||||
c := jsonrpc2.NewConn(context.Background(), jsonrpc2.NewBufferedStream(&readWriteCloser{eof, eof}, jsonrpc2.VarintObjectCodec{}), noopHandler{})
|
||||
c := jsonrpc2.NewConn(context.Background(), jsonrpc2.NewBufferedStream(&readWriteCloser{eof, eof}, jsonrpc2.VarintObjectCodec{}), jsonrpc2.NoopHandler{})
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
if err := c.Call(context.Background(), "m", nil, nil); err != jsonrpc2.ErrClosed {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue