TestProxyWithConfigWebSocketNonTLS2NonTLS tests the proxy with non-TLS to non-TLS WebSocket connection.
(t *testing.T)
| 997 | |
| 998 | // TestProxyWithConfigWebSocketNonTLS2NonTLS tests the proxy with non-TLS to non-TLS WebSocket connection. |
| 999 | func TestProxyWithConfigWebSocketNonTLS2NonTLS(t *testing.T) { |
| 1000 | /* |
| 1001 | Arrange |
| 1002 | */ |
| 1003 | // Create a WebSocket test server (non-TLS) |
| 1004 | srv := createSimpleWebSocketServer(false) |
| 1005 | defer srv.Close() |
| 1006 | |
| 1007 | // create proxy server (non-TLS to non-TLS) |
| 1008 | ts := createSimpleProxyServer(t, srv, false, false) |
| 1009 | defer ts.Close() |
| 1010 | |
| 1011 | tsURL, _ := url.Parse(ts.URL) |
| 1012 | tsURL.Scheme = "ws" |
| 1013 | tsURL.Path = "/" |
| 1014 | |
| 1015 | /* |
| 1016 | Act |
| 1017 | */ |
| 1018 | |
| 1019 | // Connect to the proxy WebSocket |
| 1020 | wsConn, err := websocket.Dial(tsURL.String(), "", "http://localhost/") |
| 1021 | assert.NoError(t, err) |
| 1022 | defer wsConn.Close() |
| 1023 | |
| 1024 | // Send message |
| 1025 | sendMsg := "Hello, Non TLS WebSocket!" |
| 1026 | err = websocket.Message.Send(wsConn, sendMsg) |
| 1027 | assert.NoError(t, err) |
| 1028 | |
| 1029 | /* |
| 1030 | Assert |
| 1031 | */ |
| 1032 | // Read response |
| 1033 | var recvMsg string |
| 1034 | err = websocket.Message.Receive(wsConn, &recvMsg) |
| 1035 | assert.NoError(t, err) |
| 1036 | assert.Equal(t, sendMsg, recvMsg) |
| 1037 | } |
| 1038 | |
| 1039 | // TestProxyWithConfigWebSocketTLS2TLS tests the proxy with TLS to TLS WebSocket connection. |
| 1040 | func TestProxyWithConfigWebSocketTLS2TLS(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…