diff --git a/client/client.go b/client/client.go index 0f8cfb195..6af8f5a89 100644 --- a/client/client.go +++ b/client/client.go @@ -38,6 +38,8 @@ type Client interface { *gethrpc.ClientSubscription, error) URL() string + + Close() } type client struct { @@ -51,6 +53,10 @@ func (c client) URL() string { return c.url } +func (c client) Close() { + c.Client.Close() +} + // Connect connects to the provided url func Connect(url string) (Client, error) { log.Printf("Connecting to %v...", url) diff --git a/client/mocks/Client.go b/client/mocks/Client.go index 4d3e9f081..0efd9fd26 100644 --- a/client/mocks/Client.go +++ b/client/mocks/Client.go @@ -31,6 +31,11 @@ func (_m *Client) Call(result interface{}, method string, args ...interface{}) e return r0 } +// Close provides a mock function with given fields: +func (_m *Client) Close() { + _m.Called() +} + // Subscribe provides a mock function with given fields: ctx, namespace, subscribeMethodSuffix, unsubscribeMethodSuffix, notificationMethodSuffix, channel, args func (_m *Client) Subscribe(ctx context.Context, namespace string, subscribeMethodSuffix string, unsubscribeMethodSuffix string, notificationMethodSuffix string, channel interface{}, args ...interface{}) (*rpc.ClientSubscription, error) { var _ca []interface{}