MCPcopy Index your code
hub / github.com/labstack/echo / TestProxyWithConfigWebSocketNonTLS2NonTLS

Function TestProxyWithConfigWebSocketNonTLS2NonTLS

middleware/proxy_test.go:999–1037  ·  view source on GitHub ↗

TestProxyWithConfigWebSocketNonTLS2NonTLS tests the proxy with non-TLS to non-TLS WebSocket connection.

(t *testing.T)

Source from the content-addressed store, hash-verified

997
998// TestProxyWithConfigWebSocketNonTLS2NonTLS tests the proxy with non-TLS to non-TLS WebSocket connection.
999func 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.
1040func TestProxyWithConfigWebSocketTLS2TLS(t *testing.T) {

Callers

nothing calls this directly

Calls 4

createSimpleProxyServerFunction · 0.85
CloseMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…