// TODO: fix the server start and shutdown
func TestSimpleStartStop(t *testing.T) {
	resp, err := http.Get("http://localhost:8080/")
	if resp != nil || err == nil {
		t.Fatal("Server is already running")
	}

	go proxyondemand.Start("localhost:8080")

	resp, err = http.Get("http://localhost:8080/")
	if err != nil {
		t.Fatal("Server is not running")
	}

	// proxyondemand.Stop()
	// resp, err = http.Get("http://localhost:8080/")
	// if resp != nil || err == nil {
	// 	t.Fatal("Server is still running")
	// }
}
Example #2
0
func main() {
	proxyondemand.Start("localhost:8080")
}