github.com/apernet/quic-go@v0.43.1-0.20240515053213-5e9e635fd9f0/internal/handshake/handshake_suite_test.go (about)

     1  package handshake
     2  
     3  import (
     4  	"crypto/tls"
     5  	"encoding/hex"
     6  	"strings"
     7  	"testing"
     8  
     9  	. "github.com/onsi/ginkgo/v2"
    10  	. "github.com/onsi/gomega"
    11  	"go.uber.org/mock/gomock"
    12  )
    13  
    14  func TestHandshake(t *testing.T) {
    15  	RegisterFailHandler(Fail)
    16  	RunSpecs(t, "Handshake Suite")
    17  }
    18  
    19  var mockCtrl *gomock.Controller
    20  
    21  var _ = BeforeEach(func() {
    22  	mockCtrl = gomock.NewController(GinkgoT())
    23  })
    24  
    25  var _ = AfterEach(func() {
    26  	mockCtrl.Finish()
    27  })
    28  
    29  func splitHexString(s string) (slice []byte) {
    30  	for _, ss := range strings.Split(s, " ") {
    31  		if ss[0:2] == "0x" {
    32  			ss = ss[2:]
    33  		}
    34  		d, err := hex.DecodeString(ss)
    35  		ExpectWithOffset(1, err).ToNot(HaveOccurred())
    36  		slice = append(slice, d...)
    37  	}
    38  	return
    39  }
    40  
    41  var cipherSuites = []*cipherSuite{
    42  	getCipherSuite(tls.TLS_AES_128_GCM_SHA256),
    43  	getCipherSuite(tls.TLS_AES_256_GCM_SHA384),
    44  	getCipherSuite(tls.TLS_CHACHA20_POLY1305_SHA256),
    45  }