Test conn (#199)

* test: add conn tests

* test: add ConnStatus tests

* test: add error test

* test: add more conn tests
This commit is contained in:
Mikhail Bragin
2022-01-21 13:52:19 +01:00
committed by GitHub
parent dfa67410b5
commit 2ad899b066
8 changed files with 245 additions and 9 deletions

View File

@@ -54,3 +54,19 @@ func NewConnectionDisconnectedError(peer string) error {
peer: peer,
}
}
// ConnectionAlreadyClosedError is an error indicating that a peer Conn has been already closed and the invocation of the Close() method has been performed over a closed connection
type ConnectionAlreadyClosedError struct {
peer string
}
func (e *ConnectionAlreadyClosedError) Error() string {
return fmt.Sprintf("connection to peer %s has been already closed", e.peer)
}
// NewConnectionAlreadyClosed creates a new ConnectionAlreadyClosedError error
func NewConnectionAlreadyClosed(peer string) error {
return &ConnectionAlreadyClosedError{
peer: peer,
}
}