(t *testing.T)
| 18 | ) |
| 19 | |
| 20 | func TestRawTCPServiceEstablishConnection(t *testing.T) { |
| 21 | originListener, err := net.Listen("tcp", "127.0.0.1:0") |
| 22 | require.NoError(t, err) |
| 23 | |
| 24 | listenerClosed := make(chan struct{}) |
| 25 | tcpListenRoutine(originListener, listenerClosed) |
| 26 | |
| 27 | rawTCPService := &rawTCPService{name: ServiceWarpRouting} |
| 28 | |
| 29 | req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s", originListener.Addr()), nil) |
| 30 | require.NoError(t, err) |
| 31 | |
| 32 | originListener.Close() |
| 33 | <-listenerClosed |
| 34 | |
| 35 | req, err = http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s", originListener.Addr()), nil) |
| 36 | require.NoError(t, err) |
| 37 | |
| 38 | // Origin not listening for new connection, should return an error |
| 39 | _, err = rawTCPService.EstablishConnection(context.Background(), req.URL.String(), TestLogger) |
| 40 | require.Error(t, err) |
| 41 | } |
| 42 | |
| 43 | func TestTCPOverWSServiceEstablishConnection(t *testing.T) { |
| 44 | originListener, err := net.Listen("tcp", "127.0.0.1:0") |
nothing calls this directly
no test coverage detected