mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-05-10 23:06:35 +00:00

Also changed the socks test code so that it binds to localhost, so that we don't get popups saying "would you like to allow socks.test to use the network"
39 lines
801 B
Go
39 lines
801 B
Go
package hello
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestCreateTLSListenerHostAndPortSuccess(t *testing.T) {
|
|
listener, err := CreateTLSListener("localhost:1234")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer listener.Close()
|
|
if listener.Addr().String() == "" {
|
|
t.Fatal("Fail to find available port")
|
|
}
|
|
}
|
|
|
|
func TestCreateTLSListenerOnlyHostSuccess(t *testing.T) {
|
|
listener, err := CreateTLSListener("localhost:")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer listener.Close()
|
|
if listener.Addr().String() == "" {
|
|
t.Fatal("Fail to find available port")
|
|
}
|
|
}
|
|
|
|
func TestCreateTLSListenerOnlyPortSuccess(t *testing.T) {
|
|
listener, err := CreateTLSListener("localhost:8888")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer listener.Close()
|
|
if listener.Addr().String() == "" {
|
|
t.Fatal("Fail to find available port")
|
|
}
|
|
}
|