Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

net_conn_mock.go 855B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package testlib
  2. import (
  3. "net"
  4. "time"
  5. "github.com/stretchr/testify/mock"
  6. )
  7. type NetConnMock struct {
  8. mock.Mock
  9. }
  10. func (n *NetConnMock) Read(b []byte) (int, error) {
  11. args := n.Called(b)
  12. return args.Int(0), args.Error(1)
  13. }
  14. func (n *NetConnMock) Write(b []byte) (int, error) {
  15. args := n.Called(b)
  16. return args.Int(0), args.Error(1)
  17. }
  18. func (n *NetConnMock) Close() error {
  19. return n.Called().Error(0)
  20. }
  21. func (n *NetConnMock) LocalAddr() net.Addr {
  22. return n.Called().Get(0).(net.Addr)
  23. }
  24. func (n *NetConnMock) RemoteAddr() net.Addr {
  25. return n.Called().Get(0).(net.Addr)
  26. }
  27. func (n *NetConnMock) SetDeadline(t time.Time) error {
  28. return n.Called(t).Error(0)
  29. }
  30. func (n *NetConnMock) SetReadDeadline(t time.Time) error {
  31. return n.Called(t).Error(0)
  32. }
  33. func (n *NetConnMock) SetWriteDeadline(t time.Time) error {
  34. return n.Called(t).Error(0)
  35. }