1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
14 func TestServer(t *testing.T) {
15 ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
16 w.Write([]byte("hello"))
19 res, err := http.Get(ts.URL)
23 got, err := ioutil.ReadAll(res.Body)
27 if string(got) != "hello" {
28 t.Errorf("got %q, want hello", string(got))
32 func TestIssue7264(t *testing.T) {
33 t.Skip("broken test - removed at tip")
34 for i := 0; i < 1000; i++ {
36 inHandler := make(chan bool, 1)
37 ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
41 tr := &http.Transport{
42 ResponseHeaderTimeout: time.Nanosecond,
44 defer tr.CloseIdleConnections()
45 c := &http.Client{Transport: tr}
46 res, err := c.Get(ts.URL)