Created
May 7, 2013 22:54
-
-
Save MadanThangavelu/5536845 to your computer and use it in GitHub Desktop.
Query local https server in parallel
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
require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper')) | |
require 'net/https' | |
require 'uri' | |
threads = [] | |
(1..32).each do |page| | |
threads << Thread.new(page) { |myPage| | |
uri = URI.parse("https://localhost:8443") | |
h = Net::HTTP.new(uri.host, uri.port) | |
h.use_ssl = true | |
h.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
request = Net::HTTP::Get.new(uri.request_uri) | |
response = h.request(request) | |
puts response.body | |
} | |
end | |
threads.each { |aThread| aThread.join } | |
sleep(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment