jdk/test/com/sun/net/httpserver/bugs/B6361557.java
changeset 6115 7c523cf2bc8a
parent 5506 202f599c92aa
child 6132 bb7d59eb0f18
equal deleted inserted replaced
6114:9d463b9408ba 6115:7c523cf2bc8a
    33 import java.util.concurrent.*;
    33 import java.util.concurrent.*;
    34 import java.io.*;
    34 import java.io.*;
    35 import java.nio.*;
    35 import java.nio.*;
    36 import java.nio.channels.*;
    36 import java.nio.channels.*;
    37 import java.net.*;
    37 import java.net.*;
    38 import java.security.*;
       
    39 import java.security.cert.*;
       
    40 import javax.net.ssl.*;
       
    41 
    38 
    42 /**
    39 /**
    43  * The test simply opens 10,000 separate connections
    40  * The test simply opens 1,000 separate connections
    44  * and invokes one http request on each. The client does
    41  * and invokes one http request on each. The client does
    45  * not close any sockets until after they are closed
    42  * not close any sockets until after they are closed
    46  * by the server. This verifies the basic ability
    43  * by the server. This verifies the basic ability
    47  * of the server to manage a reasonable number of connections
    44  * of the server to manage a reasonable number of connections
    48  */
    45  */
    49 public class B6361557 {
    46 public class B6361557 {
    50 
    47 
    51     public static boolean error = false;
    48     public static boolean error = false;
       
    49     static final int NUM = 1000;
    52 
    50 
    53     static class Handler implements HttpHandler {
    51     static class Handler implements HttpHandler {
    54         int invocation = 1;
    52         int invocation = 1;
    55         public void handle (HttpExchange t)
    53         public void handle (HttpExchange t)
    56             throws IOException
    54             throws IOException
    73 
    71 
    74         ExecutorService executor = Executors.newCachedThreadPool();
    72         ExecutorService executor = Executors.newCachedThreadPool();
    75         server.setExecutor (executor);
    73         server.setExecutor (executor);
    76         server.start ();
    74         server.start ();
    77 
    75 
    78         final int NUM = 10000;
       
    79         ByteBuffer buf = ByteBuffer.allocate (4096);
    76         ByteBuffer buf = ByteBuffer.allocate (4096);
    80         InetSocketAddress destaddr = new InetSocketAddress (
    77         InetSocketAddress destaddr = new InetSocketAddress (
    81                 "127.0.0.1", server.getAddress().getPort()
    78                 "127.0.0.1", server.getAddress().getPort()
    82         );
    79         );
    83         System.out.println ("destaddr " + destaddr);
    80         System.out.println ("destaddr " + destaddr);