Skip to content

Commit

Permalink
work around golang/go#12262
Browse files Browse the repository at this point in the history
  • Loading branch information
powerman committed Sep 5, 2015
1 parent d0a6e70 commit 65bac2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions jsonrpc2/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,17 @@ func BenchmarkGOBRPC_tcp(b *testing.B) {

func BenchmarkJSONRPC2_http(b *testing.B) {
ts := httptest.NewServer(jsonrpc2.HTTPHandler(nil))
defer ts.Close()
// Don't close because of https://github.com/golang/go/issues/12262
// defer ts.Close()
client := jsonrpc2.NewHTTPClient(ts.URL)
defer client.Close()
benchmarkRPC(b, client)
}

func BenchmarkGOBRPC_http(b *testing.B) {
ts := httptest.NewServer(rpc.DefaultServer)
defer ts.Close()
// Don't close because of https://github.com/golang/go/issues/12262
// defer ts.Close()
client, err := rpc.DialHTTP("tcp", ts.URL[7:])
if err != nil {
b.Errorf("rpc.DialHTTP(tcp, %q), err = %v", ts.URL, err)
Expand Down
6 changes: 4 additions & 2 deletions jsonrpc2/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func TestHTTPServer(t *testing.T) {
}

ts := httptest.NewServer(jsonrpc2.HTTPHandler(nil))
defer ts.Close()
// Don't close because of https://github.com/golang/go/issues/12262
// defer ts.Close()

for _, c := range cases {
req, err := http.NewRequest(c.method, ts.URL, strings.NewReader(c.body))
Expand Down Expand Up @@ -100,7 +101,8 @@ func TestHTTPServer(t *testing.T) {

func TestHTTPClient(t *testing.T) {
ts := httptest.NewServer(jsonrpc2.HTTPHandler(nil))
defer ts.Close()
// Don't close because of https://github.com/golang/go/issues/12262
// defer ts.Close()
client := jsonrpc2.NewHTTPClient(ts.URL)
defer client.Close()

Expand Down

0 comments on commit 65bac2c

Please sign in to comment.