2021-09-05 14:49:38 +02:00
|
|
|
package mocks
|
2021-06-25 20:51:59 +02:00
|
|
|
|
2021-09-05 21:23:47 +02:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"crypto/tls"
|
|
|
|
)
|
2021-06-25 20:51:59 +02:00
|
|
|
|
|
|
|
// TLSConn allows to mock netxlite.TLSConn.
|
|
|
|
type TLSConn struct {
|
|
|
|
// Conn is the embedded mockable Conn.
|
|
|
|
Conn
|
|
|
|
|
|
|
|
// MockConnectionState allows to mock the ConnectionState method.
|
|
|
|
MockConnectionState func() tls.ConnectionState
|
|
|
|
|
2021-09-05 21:23:47 +02:00
|
|
|
// MockHandshakeContext allows to mock the HandshakeContext method.
|
|
|
|
MockHandshakeContext func(ctx context.Context) error
|
2021-06-25 20:51:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ConnectionState calls MockConnectionState.
|
|
|
|
func (c *TLSConn) ConnectionState() tls.ConnectionState {
|
|
|
|
return c.MockConnectionState()
|
|
|
|
}
|
|
|
|
|
2021-09-05 21:23:47 +02:00
|
|
|
// HandshakeContext calls MockHandshakeContext.
|
|
|
|
func (c *TLSConn) HandshakeContext(ctx context.Context) error {
|
|
|
|
return c.MockHandshakeContext(ctx)
|
2021-06-25 20:51:59 +02:00
|
|
|
}
|