(module proxy-test mzscheme
(require
(lib "tcp-unit.ss" "net")
(lib "url.ss" "net")
(planet "test.ss" ("schematics" "schemeunit.plt" 2))
(file "proxy.ss"))
(provide proxy-tests)
(define (request->path method url headers)
(cond [(regexp-match #rx#"local.html$" url)
(string->path "local.html")]
[else #f]))
(define shutdown-proxy
(run-proxy request->path #f 7654 10 tcp@))
(current-proxy-servers '(("http" "localhost" 7654)))
(sleep 1)
(define proxy-tests
(test-suite
"All tests for proxy"
(test-case
"remote host is proxied"
(let ([ip
(get-pure-port (string->url "http://www.google.co.uk/"))])
(after
(check-not-false (regexp-match #rx"Google" ip))
(close-input-port ip))))
))
)