You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: dialer_test.go
    path of file: ./repos/ws
    
    the code of the file until where you have to start completion: package ws

import (
	"bufio"
	"bytes"
	"context"
	"encoding/base64"
	"fmt"
	"io"
	"io/ioutil"
	"math/rand"
	"net"
	"net/http"
	"net/url"
	"testing"
	"time"

	"github.com/gobwas/httphead"
)

func TestDialerRequest(t *testing.T) {
	for _, test := range []struct {
		dialer Dialer
		url    string
		exp    *http.Request
		err    bool
	}{
		{
			url: "wss://example.org/chat",
			exp: setProto(1, 1,
				mustMakeRequest("GET", "wss://example.org/chat", http.Header{
					headerUpgrade:    []string{"websocket"},
					headerConnection: []string{"Upg
    
func TestHostPort(t *testing.T) {
	for _, test := range []struct {
		name string
		host string
		port string

		expHostname string
		expHostport string
	}{
		{
			host:        "foo",
			port:        ":80",
			expHostname: "foo",
			expHostport: "foo:80",
		},
		{
			host:        "foo:1234",
			port:        ":80",
			expHostname: "foo",
			expHostport: "foo:1234",
		},
		{
			name:        "ipv4",
			host:        "127.0.0.1",
			port:        ":80",
			expHostname: "127.0.0.1",
			expHostport: "127.0.0.1:80",
		},
		{
			name:        "ipv4",
			host:        "127.0.0.1:1234",
			port:        ":80",
			expHostname: "127.0.0.1",
			expHostport: "127.0.0.1:1234",
		},
		{
			name:        "ipv6",
			host:        "[0:0:0:0:0:0:0:1]",
			port:        ":80",
			expHostname: "[0:0:0:0:0:0:0:1]",
			expHostport: "[0:0:0:0:0:0:0:1]:80",
		},
		{
			name:        "ipv6",
			host:        "[0:0:0:0:0:0:0:1]:1234",
			port:        ":80",
			expHostname: "[0:0:0:0:0:0:0:1]",
			expHostport: "[0:0:0:0:0:0:0:1]:1234",
		},
	} {
		t.Run(test.name, func(t *testing.T) {
			actHostname, actHostport := hostport(test.host, test.port)
			if actHostname != test.expHostname {
				t.Errorf(
					"actual hostname = %q; want %q",
					actHostname, test.expHostname,
				)
			}
			if actHostport != test.expHostport {
				t.Errorf(
					"actual hostname = %q; want %q",
					actHostport, test.expHostport,
				)
			}
		})
	}
}