1 4 5 9 10 11 package org.openlaszlo.test; 12 13 import java.io.*; 14 import java.net.Socket ; 15 16 import org.apache.commons.httpclient.*; 17 import org.apache.commons.httpclient.methods.*; 18 import org.openlaszlo.utils.FileUtils; 19 20 21 public class bigpost { 22 static public void main (String args[]) { 23 Socket socket = null; 24 int i = 0; 25 int j = 0; 26 27 try { 28 61 62 String host = args[0]; 63 int port = Integer.parseInt(args[1]); 64 String uri = args[2]; 65 66 OutputStream outf = new FileOutputStream(args[3]); 67 socket = new Socket (host, port); 68 69 System.out.println("Made socket to " + host + ":" + port); 70 71 int length = Integer.parseInt(args[4]); 73 Writer out = new OutputStreamWriter( 74 socket.getOutputStream(), "ISO-8859-1"); 75 out.write("POST " + uri + " HTTP/1.1\r\n"); 76 out.write("Host: " + host + ":" + port + "\r\n"); 77 out.write("User-Agent: bigpost\r\n"); 78 out.write("Content-type: application/x-www-form-urlencoded\r\n"); 79 out.write("Content-length: " + length + "\r\n"); 80 out.write("\r\n"); 81 out.flush(); 82 out.write("lzt=data\r\n"); 83 out.write("reqtype=POST\r\n"); 84 out.write("cache=false\r\n"); 85 out.write("ccache=false\r\n"); 86 out.write("sendheaders=false\r\n"); 87 out.write("url=http://localhost:8080/lps/build.xml?x="); 88 while(true) { 89 out.write("x"); 90 if (i % 1000 == 0) { 91 out.flush(); 92 System.err.println("" + i); 93 j = i; 94 } 95 i++; 96 } 97 98 101 103 } catch (Exception e) { 104 System.err.println("bytes sent: " + i); 105 System.err.println("bytes flushed: " + j); 106 e.printStackTrace(); 107 } finally { 108 try { 109 socket.close(); 110 } catch (IOException e) { 111 } 112 } 113 } 114 } 115 | Popular Tags |