cloudflare/cloudflared

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2019.10.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

hello/hello_test.go

38lines · modecode

1package hello
2
3import (
4 "testing"
5)
6
7func TestCreateTLSListenerHostAndPortSuccess(t *testing.T) {
8 listener, err := CreateTLSListener("localhost:1234")
9 if err != nil {
10 t.Fatal(err)
11 }
12 defer listener.Close()
13 if listener.Addr().String() == "" {
14 t.Fatal("Fail to find available port")
15 }
16}
17
18func TestCreateTLSListenerOnlyHostSuccess(t *testing.T) {
19 listener, err := CreateTLSListener("localhost:")
20 if err != nil {
21 t.Fatal(err)
22 }
23 defer listener.Close()
24 if listener.Addr().String() == "" {
25 t.Fatal("Fail to find available port")
26 }
27}
28
29func TestCreateTLSListenerOnlyPortSuccess(t *testing.T) {
30 listener, err := CreateTLSListener(":8888")
31 if err != nil {
32 t.Fatal(err)
33 }
34 defer listener.Close()
35 if listener.Addr().String() == "" {
36 t.Fatal("Fail to find available port")
37 }
38}
39