mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-05-10 14:58:27 +00:00
use custom port for test.js
This commit is contained in:
parent
4e65353a29
commit
a7ef1b2215
@ -302,6 +302,7 @@ function connectReqHandler(req, socket, head){
|
|||||||
socket.write('HTTP/' + req.httpVersion + ' 200 OK\r\n\r\n', 'UTF-8', function() {
|
socket.write('HTTP/' + req.httpVersion + ' 200 OK\r\n\r\n', 'UTF-8', function() {
|
||||||
conn.pipe(socket);
|
conn.pipe(socket);
|
||||||
socket.pipe(conn);
|
socket.pipe(conn);
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
1
proxy.js
1
proxy.js
@ -149,7 +149,6 @@ function proxyServer(option){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO : uncaught exception
|
|
||||||
//kill web server when father process exits
|
//kill web server when father process exits
|
||||||
process.on("exit",function(code){
|
process.on("exit",function(code){
|
||||||
child_webServer.kill();
|
child_webServer.kill();
|
||||||
|
5
test.js
5
test.js
@ -2,11 +2,12 @@ var tester = require("proxy-eval"),
|
|||||||
proxy = require("./proxy.js");
|
proxy = require("./proxy.js");
|
||||||
|
|
||||||
new proxy.proxyServer({
|
new proxy.proxyServer({
|
||||||
type:"http"
|
type:"http",
|
||||||
|
port:8995
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
tester.test( {proxy : 'http://127.0.0.1:8001',reqTimeout:3000} ,function(results){
|
tester.test( {proxy : 'http://127.0.0.1:8995',reqTimeout:3000} ,function(results){
|
||||||
tester.printResult(results);
|
tester.printResult(results);
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user