feat(netxlite): add QUICDialerLogger (#410)

Part of https://github.com/ooni/probe/issues/1505
This commit is contained in:
Simone Basso 2021-06-26 16:54:02 +02:00 committed by GitHub
commit 046dd4545d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 433 additions and 2 deletions

View file

@ -0,0 +1,34 @@
package netxmocks
import (
"crypto/tls"
"errors"
"reflect"
"testing"
)
func TestTLSConnConnectionState(t *testing.T) {
state := tls.ConnectionState{Version: tls.VersionTLS12}
c := &TLSConn{
MockConnectionState: func() tls.ConnectionState {
return state
},
}
out := c.ConnectionState()
if !reflect.DeepEqual(out, state) {
t.Fatal("not the result we expected")
}
}
func TestTLSConnHandshake(t *testing.T) {
expected := errors.New("mocked error")
c := &TLSConn{
MockHandshake: func() error {
return expected
},
}
err := c.Handshake()
if !errors.Is(err, expected) {
t.Fatal("not the error we expected", err)
}
}