Created
April 5, 2016 15:36
-
-
Save jochasinga/40be3157baea15a41b52d82ccaf2bf84 to your computer and use it in GitHub Desktop.
Proxy behing another Proxy in Relay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Each hop to the test server takes 1 second | |
delay := time.Duration(1) * time.Second | |
ts := httptest.NewServer(http.HandlerFunc(handler)) | |
p3 := relay.NewProxy(delay, ts) | |
p2 := relay.NewProxy(delay, p3) | |
p1 := relay.NewProxy(delay, p2) | |
start := time.Now() | |
resp, _ := client.Get(p1.URL) | |
elapsed := time.Since(start) | |
So(elapsed, ShouldAlmostEqual, time.Duration(6) * time.Second) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment