All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.mod_cluster.Client Maven / Gradle / Ivy

There is a newer version: 1.3.21.Final
Show newest version
/*
 *  mod_cluster
 *
 *  Copyright(c) 2008 Red Hat Middleware, LLC,
 *  and individual contributors as indicated by the @authors tag.
 *  See the copyright.txt in the distribution for a
 *  full listing of individual contributors.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library in the file COPYING.LIB;
 *  if not, write to the Free Software Foundation, Inc.,
 *  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 *
 * @author Jean-Frederic Clere
 * @version $Revision$
 */

package org.jboss.mod_cluster;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Random;

import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class  Client extends Thread {

    private String jsessionid = null;

    private String URL = null;

    private String BaseURL = "http://localhost:8000";
    String post = null;
    String user = null;
    String pass = null;
    InputStream fd = null;
    private String VirtualHost = null;

    private int nbtest = 10;
    private int delay = 1000;
    private int wait = 100;
    private Random rand = null;
    private boolean checkcookie = true;
    private boolean checknode = true;
    private boolean success = true;
    private String node = null;

    public int httpResponseCode = 0;
    public String requestedSessionId = null;

    private HttpClient httpClient = null;

    private String response = null;

    private boolean logok = Boolean.valueOf(System.getProperty(
                "logok",
                "false")).booleanValue();

    /*
     *  
     * Usage:
     *          java Client http://mywebserver:80/ test
     * 
     *  @param args command line arguments
     *                 Argument 0 is a URL to a web server
     *                 Argument 1 is the max time to wait between requests (in 10 milliseconds units)
     * 
     */
    public static void main(String[] args) throws Exception
        {
                if (args.length != 2)
                {
                        System.err.println("missing command line arguments");
                        System.exit(1);
                }
                Client client[] = new Client[50];
                for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy