refactor(netxlite): add factories to create TLS handshakers (#460)

See https://github.com/ooni/probe/issues/1591
This commit is contained in:
Simone Basso 2021-09-05 20:59:42 +02:00 committed by GitHub
commit 5b8df394b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 3 deletions

View file

@ -407,3 +407,21 @@ func TestTLSDialerConfigWithALPN(t *testing.T) {
t.Fatal(diff)
}
}
func TestNewTLSHandshakerStdlibTypes(t *testing.T) {
th := NewTLSHandshakerStdlib(log.Log)
thl, okay := th.(*tlsHandshakerLogger)
if !okay {
t.Fatal("invalid type")
}
if thl.Logger != log.Log {
t.Fatal("invalid logger")
}
thc, okay := thl.TLSHandshaker.(*tlsHandshakerConfigurable)
if !okay {
t.Fatal("invalid type")
}
if thc.NewConn != nil {
t.Fatal("expected nil NewConn")
}
}