Skip to content

Commit

Permalink
add a test for socks anonymize proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jirimoravcik committed Aug 19, 2024
1 parent b68c6f6 commit 93baeab
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/socks.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,24 @@ describe('SOCKS protocol', () => {
.catch(done);
});
}).timeout(5 * 1000);

it('works with anonymizeProxy', (done) => {
portastic.find({ min: 50500, max: 50750 }).then((ports) => {
const [socksPort, proxyPort] = ports;
socksServer = socksv5.createServer((info, accept) => {
accept();
});
socksServer.listen(socksPort, 'localhost');
socksServer.useAuth(socksv5.auth.None());

ProxyChain.anonymizeProxy({ port: proxyPort, url: `socks://localhost:${socksPort}` }).then(() => {
gotScraping.get({ url: 'https://example.com', proxyUrl: `http://127.0.0.1:${proxyPort}` })
.then((response) => {
expect(response.body).to.contain('Example Domain');
done();
})
.catch(done);
});
});
}).timeout(5 * 1000);
});

0 comments on commit 93baeab

Please sign in to comment.