public void test1() throws Exception {
println("running test1");
Socket s = new Socket("localhost", 8009);
Ajp13Packet p = new Ajp13Packet(Ajp13.MAX_PACKET_SIZE);
p.appendInt(0x1234);
p.appendInt(0);
p.setByteOff(4);
p.appendByte(RequestHandler.JK_AJP13_FORWARD_REQUEST);
p.appendByte((byte)2);
p.appendString("http");
p.appendString("/test_uri");
p.appendString("remote_addr");
p.appendString("remote_host");
p.appendString("server_name");
p.appendInt(80);
p.appendBool(false);
p.appendInt(3);
p.appendString("my header");
p.appendString("my header value");
p.appendInt((0xA0 << 8) + RequestHandler.SC_REQ_AUTHORIZATION);
p.appendString("some auth string");
p.appendInt((0xA0 << 8) + RequestHandler.SC_REQ_USER_AGENT);
p.appendString("TestAjp13 User Agent");
p.appendByte(RequestHandler.SC_A_ARE_DONE);
int len = p.getByteOff() - 4;
p.setByteOff(2);
p.appendInt(len);
OutputStream os = s.getOutputStream();
os.write(p.getBuff(), 0, len + 4);
InputStream is = s.getInputStream();
println("decoding response...");