26 |
from org.nongnu.storm.http.client import HTTPConnection |
from org.nongnu.storm.http.client import HTTPConnection |
27 |
from org.nongnu.storm.http.client import HTTPRequest |
from org.nongnu.storm.http.client import HTTPRequest |
28 |
from org.nongnu.storm.http.client import HTTPResponse |
from org.nongnu.storm.http.client import HTTPResponse |
29 |
|
from org.nongnu.storm.impl import TransientPool |
30 |
|
from org.nongnu.storm.modules.gispmap import GispP2PMap |
31 |
|
from org.nongnu.storm.impl.p2p import Peer |
32 |
|
from org.nongnu.storm.impl import DirPool |
33 |
|
from org.nongnu.storm.util import HTTPProxy |
34 |
|
|
35 |
host0 = "127.0.0.1" |
host0 = "127.0.0.1" |
36 |
host1 = "fishy.it.jyu.fi" |
host1 = "fishy.it.jyu.fi" |
38 |
host3 = "kanetti1390.kanetti.com" |
host3 = "kanetti1390.kanetti.com" |
39 |
|
|
40 |
port = 5555 |
port = 5555 |
41 |
request = "/rewrite/urn:x-storm:1.0:text/plain,\ |
request = "rewrite/urn:x-storm:1.0:text/plain,\ |
42 |
dvi7nrvd36pnprsmg4x55klqnqzvfgkc.f2aagxw4lfv7smbyzpm5tpf6ypajrdvh6ndqfky" |
dvi7nrvd36pnprsmg4x55klqnqzvfgkc.f2aagxw4lfv7smbyzpm5tpf6ypajrdvh6ndqfky" |
43 |
|
|
44 |
protocol1 = "HTTP/1.1" |
protocol1 = "HTTP/1.1" |
47 |
|
|
48 |
def testHTTPClient(): |
def testHTTPClient(): |
49 |
|
|
50 |
|
empty = java.util.Collections.EMPTY_SET |
51 |
|
pool = DirPool(java.io.File("/home/hemppah/cvs/storm"), empty) |
52 |
|
|
53 |
|
#pub = TransientPool(empty) |
54 |
|
#cache = TransientPool(empty) |
55 |
|
#map1 = GispP2PMap("/home/hemppah/cvs/storm") |
56 |
|
#peer = Peer(pub, cache, map1) |
57 |
|
#pool = peer.getPool() |
58 |
|
|
59 |
|
|
60 |
|
java.lang.Thread(HTTPProxy(pool, 5555)).start() |
61 |
|
|
62 |
|
print "HTTP proxy thread started..." |
63 |
|
|
64 |
httpconn = org.nongnu.storm.http.client.HTTPConnection(host0, port) |
httpconn = org.nongnu.storm.http.client.HTTPConnection(host0, port) |
65 |
|
|
66 |
req = httpconn.newRequest("GET", request, protocol2, java.lang.Boolean.FALSE) |
req = httpconn.newRequest("GET", request, protocol2, java.lang.Boolean.FALSE) |
67 |
|
print "Make GET request(s)..." |
68 |
|
|
69 |
resp = httpconn.send(req) |
resp = httpconn.send(req) |
70 |
#print resp.status, resp.reason |
print resp.status, resp.reason |
71 |
#assert resp.status == "Ok" |
#assert resp.status == "Ok" |
72 |
httpconn.close |
|
73 |
|
httpconn.close |
74 |
|
#java.lang.Thread.currentThread().interrupt() |
75 |
|
java.lang.Thread.interrupt() |
76 |
|
print "HTTP proxy thread stopped..." |