func (s *S) newHTTPListener(t testutil.TestingT) *HTTPListener { l := s.buildHTTPListener(t) if err := l.Start(); err != nil { t.Fatal(err) } return l }
func (s *S) newTCPListener(t testutil.TestingT) *TCPListener { l := &TCPListener{ IP: "127.0.0.1", ds: NewPostgresDataStore("tcp", s.pgx), discoverd: s.discoverd, } l.startPort, l.endPort = allocatePortRange(10) if err := l.Start(); err != nil { t.Fatal(err) } return l }
func (s *S) newTCPListener(t testutil.TestingT) *TCPListener { l := &TCPListener{ IP: "127.0.0.1", startPort: firstTCPPort, endPort: lastTCPPort, ds: NewPostgresDataStore("tcp", s.pgx), discoverd: s.discoverd, } if err := l.Start(); err != nil { t.Fatal(err) } return l }
func (s *S) buildHTTPListener(t testutil.TestingT) *HTTPListener { cert := tlsConfigForDomain("example.com") pair, err := tls.X509KeyPair([]byte(cert.Cert), []byte(cert.PrivateKey)) if err != nil { t.Fatal(err) } l := &HTTPListener{ Addr: "127.0.0.1:0", TLSAddr: "127.0.0.1:0", keypair: pair, ds: NewPostgresDataStore("http", s.pgx), discoverd: s.discoverd, } return l }
func (s *S) newHTTPListener(t testutil.TestingT) *HTTPListener { pair, err := tls.X509KeyPair(localhostCert, localhostKey) if err != nil { t.Fatal(err) } l := &HTTPListener{ Addr: "127.0.0.1:0", TLSAddr: "127.0.0.1:0", keypair: pair, ds: NewPostgresDataStore("http", s.pgx), discoverd: s.discoverd, } if err := l.Start(); err != nil { t.Fatal(err) } return l }
func (s *S) newHTTPListener(t testutil.TestingT) *HTTPListener { caCert, key := tlsConfigForDomain("example.com") pair, err := tls.X509KeyPair(caCert, key) if err != nil { t.Fatal(err) } l := &HTTPListener{ Addr: "127.0.0.1:0", TLSAddr: "127.0.0.1:0", keypair: pair, ds: NewPostgresDataStore("http", s.pgx), discoverd: s.discoverd, } if err := l.Start(); err != nil { t.Fatal(err) } return l }