cloudflare/cloudflared

Public

mirrored from https://github.com/cloudflare/cloudflaredAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2018.9.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

hello/hello_test.go

38lines · modepreview

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(":8888")
	if err != nil {
		t.Fatal(err)
	}
	defer listener.Close()
	if listener.Addr().String() == "" {
		t.Fatal("Fail to find available port")
	}
}