Newer
Older
import (
"context"
"net/http"
"os"
"testing"
"time"
)
func TestEcho(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
c, resp, err := Dial(ctx, os.Getenv("WS_ECHO_SERVER_URL"), &DialOptions{
Subprotocols: []string{"echo"},
})
assert.Success(t, err)
assertSubprotocol(t, c, "echo")
assert.Equalf(t, &http.Response{}, resp, "http.Response")