(serveTLS bool)
| 939 | } |
| 940 | |
| 941 | func createSimpleWebSocketServer(serveTLS bool) *httptest.Server { |
| 942 | handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 943 | wsHandler := func(conn *websocket.Conn) { |
| 944 | defer conn.Close() |
| 945 | for { |
| 946 | var msg string |
| 947 | err := websocket.Message.Receive(conn, &msg) |
| 948 | if err != nil { |
| 949 | return |
| 950 | } |
| 951 | // message back to the client |
| 952 | websocket.Message.Send(conn, msg) |
| 953 | } |
| 954 | } |
| 955 | websocket.Server{Handler: wsHandler}.ServeHTTP(w, r) |
| 956 | }) |
| 957 | if serveTLS { |
| 958 | return httptest.NewTLSServer(handler) |
| 959 | } |
| 960 | return httptest.NewServer(handler) |
| 961 | } |
| 962 | |
| 963 | func createSimpleProxyServer(t *testing.T, srv *httptest.Server, serveTLS bool, toTLS bool) *httptest.Server { |
| 964 | e := echo.New() |
no test coverage detected
searching dependent graphs…