< prev index next >

test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 6834246 6842687
  26  * @summary Stress test connections through the loopback interface
  27  * @run main StressLoopback
  28  * @run main/othervm -Djdk.net.useFastTcpLoopback StressLoopback

  29  */
  30 
  31 import java.nio.ByteBuffer;
  32 import java.net.*;
  33 import java.nio.channels.*;
  34 import java.util.Random;
  35 import java.io.IOException;
  36 
  37 public class StressLoopback {
  38     static final Random rand = new Random();
  39 
  40     public static void main(String[] args) throws Exception {
  41         // setup listener
  42         AsynchronousServerSocketChannel listener =
  43             AsynchronousServerSocketChannel.open().bind(new InetSocketAddress(0));
  44         int port =((InetSocketAddress)(listener.getLocalAddress())).getPort();
  45         InetAddress lh = InetAddress.getLocalHost();
  46         SocketAddress remote = new InetSocketAddress(lh, port);
  47 
  48         // create sources and sinks




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 6834246 6842687
  26  * @summary Stress test connections through the loopback interface
  27  * @run main StressLoopback
  28  * @run main/othervm -Djdk.net.useFastTcpLoopback StressLoopback
  29  * @key randomness
  30  */
  31 
  32 import java.nio.ByteBuffer;
  33 import java.net.*;
  34 import java.nio.channels.*;
  35 import java.util.Random;
  36 import java.io.IOException;
  37 
  38 public class StressLoopback {
  39     static final Random rand = new Random();
  40 
  41     public static void main(String[] args) throws Exception {
  42         // setup listener
  43         AsynchronousServerSocketChannel listener =
  44             AsynchronousServerSocketChannel.open().bind(new InetSocketAddress(0));
  45         int port =((InetSocketAddress)(listener.getLocalAddress())).getPort();
  46         InetAddress lh = InetAddress.getLocalHost();
  47         SocketAddress remote = new InetSocketAddress(lh, port);
  48 
  49         // create sources and sinks


< prev index next >