@@ -34,7 +34,7 @@ func TestHandshake(t *testing.T) {
3434 {
3535 name : "handshake" ,
3636 server : func (w http.ResponseWriter , r * http.Request ) error {
37- c , err := websocket .Accept (w , r , websocket .AcceptSubprotocols ("myproto" ))
37+ c , err := websocket .Accept (w , r , websocket .AcceptProtocols ("myproto" ))
3838 if err != nil {
3939 return err
4040 }
@@ -74,8 +74,8 @@ func TestHandshake(t *testing.T) {
7474 }
7575 defer c .Close (websocket .StatusInternalError , "" )
7676
77- if c .Subprotocol () != "" {
78- return xerrors .Errorf ("unexpected subprotocol: %v" , c .Subprotocol ())
77+ if c .Protocol () != "" {
78+ return xerrors .Errorf ("unexpected subprotocol: %v" , c .Protocol ())
7979 }
8080 return nil
8181 },
@@ -86,23 +86,23 @@ func TestHandshake(t *testing.T) {
8686 }
8787 defer c .Close (websocket .StatusInternalError , "" )
8888
89- if c .Subprotocol () != "" {
90- return xerrors .Errorf ("unexpected subprotocol: %v" , c .Subprotocol ())
89+ if c .Protocol () != "" {
90+ return xerrors .Errorf ("unexpected subprotocol: %v" , c .Protocol ())
9191 }
9292 return nil
9393 },
9494 },
9595 {
9696 name : "subprotocol" ,
9797 server : func (w http.ResponseWriter , r * http.Request ) error {
98- c , err := websocket .Accept (w , r , websocket .AcceptSubprotocols ("echo" , "lar" ))
98+ c , err := websocket .Accept (w , r , websocket .AcceptProtocols ("echo" , "lar" ))
9999 if err != nil {
100100 return err
101101 }
102102 defer c .Close (websocket .StatusInternalError , "" )
103103
104- if c .Subprotocol () != "echo" {
105- return xerrors .Errorf ("unexpected subprotocol: %q" , c .Subprotocol ())
104+ if c .Protocol () != "echo" {
105+ return xerrors .Errorf ("unexpected subprotocol: %q" , c .Protocol ())
106106 }
107107 return nil
108108 },
@@ -113,8 +113,8 @@ func TestHandshake(t *testing.T) {
113113 }
114114 defer c .Close (websocket .StatusInternalError , "" )
115115
116- if c .Subprotocol () != "echo" {
117- return xerrors .Errorf ("unexpected subprotocol: %q" , c .Subprotocol ())
116+ if c .Protocol () != "echo" {
117+ return xerrors .Errorf ("unexpected subprotocol: %q" , c .Protocol ())
118118 }
119119 return nil
120120 },
@@ -266,7 +266,7 @@ func TestAutobahnServer(t *testing.T) {
266266
267267 s := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
268268 c , err := websocket .Accept (w , r ,
269- websocket .AcceptSubprotocols ("echo" ),
269+ websocket .AcceptProtocols ("echo" ),
270270 )
271271 if err != nil {
272272 t .Logf ("server handshake failed: %+v" , err )
0 commit comments