| 280 | } |
| 281 | |
| 282 | func TestRunQUIC(t *testing.T) { |
| 283 | router := New() |
| 284 | go func() { |
| 285 | router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") }) |
| 286 | |
| 287 | assert.NoError(t, router.RunQUIC(":8443", "./testdata/certificate/cert.pem", "./testdata/certificate/key.pem")) |
| 288 | }() |
| 289 | |
| 290 | // have to wait for the goroutine to start and run the server |
| 291 | // otherwise the main thread will complete |
| 292 | time.Sleep(5 * time.Millisecond) |
| 293 | |
| 294 | require.Error(t, router.RunQUIC(":8443", "./testdata/certificate/cert.pem", "./testdata/certificate/key.pem")) |
| 295 | testRequest(t, "https://localhost:8443/example") |
| 296 | } |
| 297 | |
| 298 | func TestFileDescriptor(t *testing.T) { |
| 299 | router := New() |