8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]

Reviewed-by: chegar, clanger
This commit is contained in:
Ivan Gerasimov 2018-03-27 13:22:40 -07:00
parent 704b2ccd93
commit 3d160a80fc
36 changed files with 725 additions and 870 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -920,7 +920,7 @@ Java_java_net_PlainSocketImpl_socketSetOption0
/*
* Class: java_net_PlainSocketImpl
* Method: socketGetOption
* Signature: (I)I
* Signature: (ILjava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
Java_java_net_PlainSocketImpl_socketGetOption

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,10 +38,10 @@ import jdk.internal.misc.JavaIOFileDescriptorAccess;
* @author Chris Hegarty
*/
class DualStackPlainSocketImpl extends AbstractPlainSocketImpl
{
static JavaIOFileDescriptorAccess fdAccess = SharedSecrets.getJavaIOFileDescriptorAccess();
class DualStackPlainSocketImpl extends AbstractPlainSocketImpl {
private static final JavaIOFileDescriptorAccess fdAccess =
SharedSecrets.getJavaIOFileDescriptorAccess();
// true if this socket is exclusively bound
private final boolean exclusiveBind;

View File

@ -27,6 +27,8 @@ package java.net;
import java.io.IOException;
import java.io.FileDescriptor;
import sun.net.ResourceManager;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.JavaIOFileDescriptorAccess;
/*
* This class defines the plain SocketImpl that is used when
@ -37,16 +39,15 @@ import sun.net.ResourceManager;
class TwoStacksPlainSocketImpl extends AbstractPlainSocketImpl {
private static final JavaIOFileDescriptorAccess fdAccess =
SharedSecrets.getJavaIOFileDescriptorAccess();
// true if this socket is exclusively bound
private final boolean exclusiveBind;
// emulates SO_REUSEADDR when exclusiveBind is true
private boolean isReuseAddress;
static {
initProto();
}
public TwoStacksPlainSocketImpl(boolean exclBind) {
exclusiveBind = exclBind;
}
@ -56,105 +57,268 @@ class TwoStacksPlainSocketImpl extends AbstractPlainSocketImpl {
exclusiveBind = exclBind;
}
public Object getOption(int opt) throws SocketException {
if (isClosedOrPending()) {
throw new SocketException("Socket Closed");
void socketCreate(boolean stream) throws IOException {
if (fd == null)
throw new SocketException("Socket closed");
int newfd = socket0(stream, false /*v6 Only*/);
fdAccess.set(fd, newfd);
}
@Override
void socketConnect(InetAddress address, int port, int timeout)
throws IOException {
int nativefd = checkAndReturnNativeFD();
if (address == null)
throw new NullPointerException("inet address argument is null.");
int connectResult;
if (timeout <= 0) {
connectResult = connect0(nativefd, address, port);
} else {
configureBlocking(nativefd, false);
try {
connectResult = connect0(nativefd, address, port);
if (connectResult == WOULDBLOCK) {
waitForConnect(nativefd, timeout);
}
} finally {
configureBlocking(nativefd, true);
}
}
if (opt == SO_BINDADDR) {
InetAddressContainer in = new InetAddressContainer();
socketGetOption(opt, in);
return in.addr;
} else if (opt == SO_REUSEADDR && exclusiveBind) {
// SO_REUSEADDR emulated when using exclusive bind
return isReuseAddress;
} else if (opt == SO_REUSEPORT) {
// SO_REUSEPORT is not supported on Windows.
throw new UnsupportedOperationException("unsupported option");
} else
return super.getOption(opt);
/*
* We need to set the local port field. If bind was called
* previous to the connect (by the client) then localport field
* will already be set.
*/
if (localport == 0)
localport = localPort0(nativefd);
}
@Override
void socketBind(InetAddress address, int port) throws IOException {
socketBind(address, port, exclusiveBind);
}
int nativefd = checkAndReturnNativeFD();
@Override
void socketSetOption(int opt, boolean on, Object value)
throws SocketException
{
// SO_REUSEADDR emulated when using exclusive bind
if (opt == SO_REUSEADDR && exclusiveBind)
isReuseAddress = on;
else if (opt == SO_REUSEPORT) {
// SO_REUSEPORT is not supported on Windows.
throw new UnsupportedOperationException("unsupported option");
if (address == null)
throw new NullPointerException("inet address argument is null.");
bind0(nativefd, address, port, exclusiveBind);
if (port == 0) {
localport = localPort0(nativefd);
} else {
localport = port;
}
else
socketNativeSetOption(opt, on, value);
this.address = address;
}
/**
* Closes the socket.
*/
@Override
protected void close() throws IOException {
synchronized(fdLock) {
if (fd != null) {
if (!stream) {
ResourceManager.afterUdpClose();
}
if (fdUseCount == 0) {
if (closePending) {
return;
}
closePending = true;
socketClose();
fd = null;
return;
} else {
/*
* If a thread has acquired the fd and a close
* isn't pending then use a deferred close.
* Also decrement fdUseCount to signal the last
* thread that releases the fd to close it.
*/
if (!closePending) {
closePending = true;
fdUseCount--;
socketClose();
}
void socketListen(int backlog) throws IOException {
int nativefd = checkAndReturnNativeFD();
listen0(nativefd, backlog);
}
@Override
void socketAccept(SocketImpl s) throws IOException {
int nativefd = checkAndReturnNativeFD();
if (s == null)
throw new NullPointerException("socket is null");
int newfd = -1;
InetSocketAddress[] isaa = new InetSocketAddress[1];
if (timeout <= 0) {
newfd = accept0(nativefd, isaa);
} else {
configureBlocking(nativefd, false);
try {
waitForNewConnection(nativefd, timeout);
newfd = accept0(nativefd, isaa);
if (newfd != -1) {
configureBlocking(newfd, true);
}
} finally {
configureBlocking(nativefd, true);
}
}
/* Update (SocketImpl)s' fd */
fdAccess.set(s.fd, newfd);
/* Update socketImpls remote port, address and localport */
InetSocketAddress isa = isaa[0];
s.port = isa.getPort();
s.address = isa.getAddress();
s.localport = localport;
}
@Override
int socketAvailable() throws IOException {
int nativefd = checkAndReturnNativeFD();
return available0(nativefd);
}
@Override
void socketClose0(boolean useDeferredClose/*unused*/) throws IOException {
if (fd == null)
throw new SocketException("Socket closed");
if (!fd.valid())
return;
final int nativefd = fdAccess.get(fd);
fdAccess.set(fd, -1);
close0(nativefd);
}
@Override
void socketShutdown(int howto) throws IOException {
int nativefd = checkAndReturnNativeFD();
shutdown0(nativefd, howto);
}
// Intentional fallthrough after SO_REUSEADDR
@SuppressWarnings("fallthrough")
@Override
void socketSetOption(int opt, boolean on, Object value)
throws SocketException {
int nativefd = checkAndReturnNativeFD();
if (opt == SO_TIMEOUT) {
// Don't enable the socket option on ServerSocket as it's
// meaningless (we don't receive on a ServerSocket).
if (serverSocket == null) {
setSoTimeout0(nativefd, ((Integer)value).intValue());
}
return;
}
// SO_REUSEPORT is not supported on Windows.
if (opt == SO_REUSEPORT) {
throw new UnsupportedOperationException("unsupported option");
}
int optionValue = 0;
switch(opt) {
case SO_REUSEADDR :
if (exclusiveBind) {
// SO_REUSEADDR emulated when using exclusive bind
isReuseAddress = on;
return;
}
// intentional fallthrough
case TCP_NODELAY :
case SO_OOBINLINE :
case SO_KEEPALIVE :
optionValue = on ? 1 : 0;
break;
case SO_SNDBUF :
case SO_RCVBUF :
case IP_TOS :
optionValue = ((Integer)value).intValue();
break;
case SO_LINGER :
if (on) {
optionValue = ((Integer)value).intValue();
} else {
optionValue = -1;
}
break;
default :/* shouldn't get here */
throw new SocketException("Option not supported");
}
setIntOption(nativefd, opt, optionValue);
}
@Override
int socketGetOption(int opt, Object iaContainerObj) throws SocketException {
int nativefd = checkAndReturnNativeFD();
// SO_BINDADDR is not a socket option.
if (opt == SO_BINDADDR) {
localAddress(nativefd, (InetAddressContainer)iaContainerObj);
return 0; // return value doesn't matter.
}
// SO_REUSEPORT is not supported on Windows.
if (opt == SO_REUSEPORT) {
throw new UnsupportedOperationException("unsupported option");
}
// SO_REUSEADDR emulated when using exclusive bind
if (opt == SO_REUSEADDR && exclusiveBind)
return isReuseAddress? 1 : -1;
int value = getIntOption(nativefd, opt);
switch (opt) {
case TCP_NODELAY :
case SO_OOBINLINE :
case SO_KEEPALIVE :
case SO_REUSEADDR :
return (value == 0) ? -1 : 1;
}
return value;
}
@Override
void socketSendUrgentData(int data) throws IOException {
int nativefd = checkAndReturnNativeFD();
sendOOB(nativefd, data);
}
private int checkAndReturnNativeFD() throws SocketException {
if (fd == null || !fd.valid())
throw new SocketException("Socket closed");
return fdAccess.get(fd);
}
static final int WOULDBLOCK = -2; // Nothing available (non-blocking)
static {
initIDs();
}
/* Native methods */
static native void initProto();
static native void initIDs();
native void socketCreate(boolean stream) throws IOException;
static native int socket0(boolean stream, boolean v6Only) throws IOException;
native void socketConnect(InetAddress address, int port, int timeout)
static native void bind0(int fd, InetAddress localAddress, int localport,
boolean exclBind)
throws IOException;
native void socketBind(InetAddress address, int port, boolean exclBind)
static native int connect0(int fd, InetAddress remote, int remotePort)
throws IOException;
native void socketListen(int count) throws IOException;
static native void waitForConnect(int fd, int timeout) throws IOException;
native void socketAccept(SocketImpl s) throws IOException;
static native int localPort0(int fd) throws IOException;
native int socketAvailable() throws IOException;
static native void localAddress(int fd, InetAddressContainer in) throws SocketException;
native void socketClose0(boolean useDeferredClose) throws IOException;
static native void listen0(int fd, int backlog) throws IOException;
native void socketShutdown(int howto) throws IOException;
static native int accept0(int fd, InetSocketAddress[] isaa) throws IOException;
native void socketNativeSetOption(int cmd, boolean on, Object value)
throws SocketException;
static native void waitForNewConnection(int fd, int timeout) throws IOException;
native int socketGetOption(int opt, Object iaContainerObj) throws SocketException;
static native int available0(int fd) throws IOException;
native void socketSendUrgentData(int data) throws IOException;
static native void close0(int fd) throws IOException;
static native void shutdown0(int fd, int howto) throws IOException;
static native void setIntOption(int fd, int cmd, int optionValue) throws SocketException;
static native void setSoTimeout0(int fd, int timeout) throws SocketException;
static native int getIntOption(int fd, int cmd) throws SocketException;
static native void sendOOB(int fd, int data) throws IOException;
static native void configureBlocking(int fd, boolean blocking) throws IOException;
}

View File

@ -51,7 +51,7 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainSocketImpl_initIDs
initInetAddressIDs(env);
// implement read timeout with select.
isRcvTimeoutSupported = 0;
isRcvTimeoutSupported = JNI_FALSE;
}
/*

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,8 +24,10 @@
/*
* @test
* @bug 4507501
* @summary Test various methods that should throw IAE when passed improper SocketAddress
*
* @summary Test various methods that should throw IAE when passed improper
* SocketAddress
* @run main AddressTest
* @run main/othervm -Djava.net.preferIPv4Stack=true AddressTest
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
* @test
* @bug 6210227
* @summary REGRESSION: Socket.getLocalAddress() returns address of 0.0.0.0 on outbound TCP
* @run main B6210227
* @run main/othervm -Djava.net.preferIPv4Stack=true B6210227
*/
import java.util.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,8 @@
* @test
* @bug 4091859
* @summary Test Socket.available()
*
* @run main CloseAvailable
* @run main/othervm -Djava.net.preferIPv4Stack=true CloseAvailable
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,8 @@
* @bug 4176738
* @summary Make sure a deadlock situation
* would not occur
* @run main DeadlockTest
* @run main/othervm -Djava.net.preferIPv4Stack=true DeadlockTest
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,8 @@
* @bug 6370908
* @summary Add support for HTTP_CONNECT proxy in Socket class
* @modules java.base/sun.net.www
* @run main HttpProxy
* @run main/othervm -Djava.net.preferIPv4Stack=true HttpProxy
*/
import java.io.IOException;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,9 +22,11 @@
*/
/* @test
@bug 6598160
@summary Windows IPv6 Socket implementation doesn't set the handle to not inherit
@author Chris Hegarty
* @bug 6598160
* @summary Windows IPv6 Socket implementation doesn't set the handle to not inherit
* @author Chris Hegarty
* @run main InheritHandle
* @run main/othervm -Djava.net.preferIPv4Stack=true InheritHandle
*/
import java.net.BindException;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,8 @@
* @bug 4508149
* @summary Setting ServerSocket.setSoTimeout shouldn't cause
* the timeout to be inherited by accepted connections
* @run main InheritTimeout
* @run main/othervm -Djava.net.preferIPv4Stack=true InheritTimeout
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
* @test
* @bug 4796166
* @summary Linger interval delays usage of released file descriptor
* @run main LingerTest
* @run main/othervm -Djava.net.preferIPv4Stack=true LingerTest
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,7 @@
* @build jdk.test.lib.NetworkConfiguration
* jdk.test.lib.Platform
* @run main LinkLocal
* @run main/othervm -Djava.net.preferIPv4Stack=true LinkLocal
*/
import jdk.test.lib.NetworkConfiguration;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
* @bug 4097826
* @summary SOCKS support inadequate
* @run main/timeout=40/othervm -DsocksProxyHost=nonexistant ProxyCons
* @run main/timeout=40/othervm -DsocksProxyHost=nonexistant -Djava.net.preferIPv4Stack=true ProxyCons
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
/*
* @bug 4468997
* @summary SO_LINGER is ignored on Windows with Winsock 2
* @run main RST
* @run main/othervm -Djava.net.preferIPv4Stack=true RST
*/
import java.net.*;
import java.io.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
* @bug 4169831
* @summary test timeout on a socket read
* @run main/timeout=15 ReadTimeout
* @run main/othervm/timeout=15 -Djava.net.preferIPv4Stack=true ReadTimeout
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,8 @@
* @test
* @bug 4151834
* @summary Test Socket.setSoLinger
*
* @run main SetSoLinger
* @run main/othervm -Djava.net.preferIPv4Stack=true SetSoLinger
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,8 @@
* @bug 7014860
* @summary Socket.getInputStream().available() not clear for
* case that connection is shutdown for reading
* @run main ShutdownInput
* @run main/othervm -Djava.net.preferIPv4Stack=true ShutdownInput
*/
import java.io.InputStream;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
* @test
* @bug 6223635
* @summary Code hangs at connect call even when Timeout is specified
* @run main SocksConnectTimeout
* @run main/othervm -Djava.net.preferIPv4Stack=true SocksConnectTimeout
*/
import java.net.InetAddress;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,10 @@
/*
* @test
* @bug 6505016
* @summary Socket spec should clarify what getInetAddress/getPort/etc return after the Socket is closed
* @summary Socket spec should clarify what getInetAddress/getPort/etc return
* after the Socket is closed
* @run main TestAfterClose
* @run main/othervm -Djava.net.preferIPv4Stack=true TestAfterClose
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,11 +22,12 @@
*/
/*
* @test
*
* @bug 4408755
*
* @summary This tests wether it's possible to get some informations
* out of a closed socket. This is for backward compatibility purposes.
* @summary This tests whether it's possible to get some informations
* out of a closed socket. This is for backward compatibility
* purposes.
* @run main TestClose
* @run main/othervm -Djava.net.preferIPv4Stack=true TestClose
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
* @test
* @bug 6404388
* @summary VISTA: Socket setTcpNoDelay & setKeepAlive working incorrectly
* @run main TestTcpNoDelay
* @run main/othervm -Djava.net.preferIPv4Stack=true TestTcpNoDelay
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
* @bug 4163126
* @summary test to see if timeout hangs
* @run main/timeout=15 Timeout
* @run main/othervm/timeout=15 -Djava.net.preferIPv4Stack=true Timeout
*/
import java.net.*;
import java.io.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,8 @@
* @bug 4511783
* @summary Test that setTrafficClass/getTraffiClass don't
* throw an exception
* @run main TrafficClass
* @run main/othervm -Djava.net.preferIPv4Stack=true TrafficClass
*/
import java.net.*;
import java.nio.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,8 @@
* @test
* @bug 4092038
* @summary TCP Urgent data support
*
* @run main UrgentDataTest
* @run main/othervm -Djava.net.preferIPv4Stack=true UrgentDataTest
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,8 @@ import static java.util.concurrent.CompletableFuture.*;
* @bug 4344135
* @summary Check that {Socket,ServerSocket,DatagramSocket}.close will
* cause any thread blocked on the socket to throw a SocketException.
* @run main AsyncClose
* @run main/othervm -Djava.net.preferIPv4Stack=true AsyncClose
*/
public class AsyncClose {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,10 +22,12 @@
*/
/*
* @test 1.1 01/09/19
* @test
* @bug 4511404
* @summary Check that a broken pipe error doesn't throw an exception
* indicating the socket is closed.
* @run main BrokenPipe
* @run main/othervm -Djava.net.preferIPv4Stack=true BrokenPipe
*/
import java.io.*;
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,8 @@
* method.
* @run main Basic
* @run main/othervm -Dsun.net.useExclusiveBind Basic
* @run main/othervm -Djava.net.preferIPv4Stack=true Basic
* @run main/othervm -Dsun.net.useExclusiveBind -Djava.net.preferIPv4Stack=true Basic
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,8 @@
* after a crash.
* @run main Restart
* @run main/othervm -Dsun.net.useExclusiveBind Restart
* @run main/othervm -Djava.net.preferIPv4Stack=true Restart
* @run main/othervm -Dsun.net.useExclusiveBind -Djava.net.preferIPv4Stack=true Restart
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,8 @@
* @bug 4681556
* @summary Wrong text if a read is performed on a socket after it
* has been closed
* @run main SocketClosedException
* @run main/othervm -Djava.net.preferIPv4Stack=true SocketClosedException
*/
import java.io.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
* @test
* @bug 4158021
* @summary cannot distinguish Thread.interrupt and Socket.setSoTimeout exceptions
* @run main SocketTimeout
* @run main/othervm -Djava.net.preferIPv4Stack=true SocketTimeout
*/
import java.net.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,8 +24,9 @@
/*
* @test
* @bug 8148609
* @run testng/othervm ImmutableOptions
* @summary Assert that the set of socket options are immutable
* @run testng/othervm ImmutableOptions
* @run testng/othervm -Djava.net.preferIPv4Stack=true ImmutableOptions
*/
import java.io.IOException;
import java.io.InputStream;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
* @test
* @bug 8170920
* @run main MinimumRcvBufferSize
* @run main/othervm -Djava.net.preferIPv4Stack=true MinimumRcvBufferSize
*/
import java.nio.channels.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,8 @@ import static java.lang.System.out;
* @summary java.net socket supportedOptions set depends on call order
* @run main/othervm SupportedOptionsSet first
* @run main/othervm SupportedOptionsSet second
* @run main/othervm -Djava.net.preferIPv4Stack=true SupportedOptionsSet first
* @run main/othervm -Djava.net.preferIPv4Stack=true SupportedOptionsSet second
*/
// Run with othervm as the implementation of the supported options sets, once

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,9 +31,10 @@ import java.util.List;
* @test
* @bug 8143554 8044773
* @summary Test checks that UnsupportedOperationException for unsupported
* SOCKET_OPTIONS is thrown by both getOption() and setOption() methods.
* SOCKET_OPTIONS is thrown by both getOption() and setOption() methods.
* @requires !vm.graal.enabled
* @run main UnsupportedOptionsTest
* @run main/othervm -Djava.net.preferIPv4Stack=true UnsupportedOptionsTest
* @run main/othervm --limit-modules=java.base UnsupportedOptionsTest
*/