diff -r f3be45662150 make/java/net/mapfile-vers
--- a/make/java/net/mapfile-vers	Tue Jan 06 13:32:22 2015 -0800
+++ b/make/java/net/mapfile-vers	Mon Jan 19 16:05:16 2015 +0300
@@ -110,6 +110,8 @@
                 NET_Bind;
                 NET_MapSocketOption;
                 NET_Wait;
+                NET_EnableFastTcpLoopback;
+                NET_ThrowNew;
                 ipv6_available;
 
         local:
diff -r f3be45662150 src/share/classes/sun/nio/ch/Net.java
--- a/src/share/classes/sun/nio/ch/Net.java	Tue Jan 06 13:32:22 2015 -0800
+++ b/src/share/classes/sun/nio/ch/Net.java	Mon Jan 19 16:05:16 2015 +0300
@@ -56,30 +56,8 @@
     // set to true if exclusive binding is on for Windows
     private static final boolean exclusiveBind;
 
-    static {
-        int availLevel = isExclusiveBindAvailable();
-        if (availLevel >= 0) {
-            String exclBindProp =
-                java.security.AccessController.doPrivileged(
-                      new PrivilegedAction<String>() {
-                          @Override
-                        public String run() {
-                            return System.getProperty(
-                                    "sun.net.useExclusiveBind");
-                        }
-                    });
-            if (exclBindProp != null) {
-                exclusiveBind = exclBindProp.length() == 0 ?
-                        true : Boolean.parseBoolean(exclBindProp);
-            } else if (availLevel == 1) {
-                exclusiveBind = true;
-            } else {
-                exclusiveBind = false;
-            }
-        } else {
-            exclusiveBind = false;
-        }
-    }
+    // set to true if the fast tcp loopback should be enabled on Windows
+    private static final boolean fastLoopback;
 
     // -- Miscellaneous utilities --
 
@@ -421,6 +399,23 @@
         }
     }
 
+    public static boolean isFastTcpLoopbackRequested() {
+        String loopbackProp = java.security.AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                @Override
+                public String run() {
+                    return System.getProperty("jdk.net.useFastTcpLoopback");
+                }
+            });
+        boolean enable;
+        if ("".equals(loopbackProp)) {
+            enable = true;
+        } else {
+            enable = Boolean.parseBoolean(loopbackProp);
+        }
+        return enable;
+    }
+
     // -- Socket operations --
 
     private static native boolean isIPv6Available0();
@@ -443,15 +438,16 @@
         throws IOException {
         boolean preferIPv6 = isIPv6Available() &&
             (family != StandardProtocolFamily.INET);
-        return IOUtil.newFD(socket0(preferIPv6, stream, false));
+        return IOUtil.newFD(socket0(preferIPv6, stream, false, fastLoopback));
     }
 
     static FileDescriptor serverSocket(boolean stream) {
-        return IOUtil.newFD(socket0(isIPv6Available(), stream, true));
+        return IOUtil.newFD(socket0(isIPv6Available(), stream, true, fastLoopback));
     }
 
     // Due to oddities SO_REUSEADDR on windows reuse is ignored
-    private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse);
+    private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse,
+                                      boolean fastLoopback);
 
     static void bind(FileDescriptor fd, InetAddress addr, int port)
         throws IOException
@@ -636,4 +632,30 @@
         initIDs();
     }
 
+    static {
+        int availLevel = isExclusiveBindAvailable();
+        if (availLevel >= 0) {
+            String exclBindProp =
+                java.security.AccessController.doPrivileged(
+                      new PrivilegedAction<String>() {
+                          @Override
+                        public String run() {
+                            return System.getProperty(
+                                    "sun.net.useExclusiveBind");
+                        }
+                    });
+            if (exclBindProp != null) {
+                exclusiveBind = exclBindProp.length() == 0 ?
+                        true : Boolean.parseBoolean(exclBindProp);
+            } else if (availLevel == 1) {
+                exclusiveBind = true;
+            } else {
+                exclusiveBind = false;
+            }
+        } else {
+            exclusiveBind = false;
+        }
+
+        fastLoopback = isFastTcpLoopbackRequested();
+    }
 }
diff -r f3be45662150 src/share/native/java/net/net_util.h
--- a/src/share/native/java/net/net_util.h	Tue Jan 06 13:32:22 2015 -0800
+++ b/src/share/native/java/net/net_util.h	Mon Jan 19 16:05:16 2015 +0300
@@ -189,6 +189,9 @@
 JNIEXPORT int JNICALL
 NET_MapSocketOptionV6(jint cmd, int *level, int *optname);
 
+JNIEXPORT jint JNICALL
+NET_EnableFastTcpLoopback(int fd);
+
 int getScopeID (struct sockaddr *);
 
 int cmpScopeID (unsigned int, struct sockaddr *);
diff -r f3be45662150 src/solaris/native/java/net/net_util_md.c
--- a/src/solaris/native/java/net/net_util_md.c	Tue Jan 06 13:32:22 2015 -0800
+++ b/src/solaris/native/java/net/net_util_md.c	Mon Jan 19 16:05:16 2015 +0300
@@ -809,6 +809,12 @@
     }
 #endif
 }
+
+JNIEXPORT jint JNICALL
+NET_EnableFastTcpLoopback(int fd) {
+    return 0;
+}
+
 /* In the case of an IPv4 Inetaddress this method will return an
  * IPv4 mapped address where IPv6 is available and v4MappedAddress is TRUE.
  * Otherwise it will return a sockaddr_in structure for an IPv4 InetAddress.
diff -r f3be45662150 src/solaris/native/sun/nio/ch/Net.c
--- a/src/solaris/native/sun/nio/ch/Net.c	Tue Jan 06 13:32:22 2015 -0800
+++ b/src/solaris/native/sun/nio/ch/Net.c	Mon Jan 19 16:05:16 2015 +0300
@@ -151,7 +151,7 @@
 
 JNIEXPORT int JNICALL
 Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
-                            jboolean stream, jboolean reuse)
+                            jboolean stream, jboolean reuse, jboolean ignored)
 {
     int fd;
     int type = (stream ? SOCK_STREAM : SOCK_DGRAM);
diff -r f3be45662150 src/windows/native/java/net/net_util_md.c
--- a/src/windows/native/java/net/net_util_md.c	Tue Jan 06 13:32:22 2015 -0800
+++ b/src/windows/native/java/net/net_util_md.c	Mon Jan 19 16:05:16 2015 +0300
@@ -29,6 +29,9 @@
 #include "net_util.h"
 #include "jni.h"
 
+// Taken from mstcpip.h in Windows SDK 8.0 or newer.
+#define SIO_LOOPBACK_FAST_PATH              _WSAIOW(IOC_VENDOR,16)
+
 #ifndef IPTOS_TOS_MASK
 #define IPTOS_TOS_MASK 0x1e
 #endif
@@ -844,6 +847,25 @@
     }
 }
 
+/**
+ * Enables SIO_LOOPBACK_FAST_PATH
+ */
+JNIEXPORT jint JNICALL
+NET_EnableFastTcpLoopback(int fd) {
+    int enabled = 1;
+    DWORD result_byte_count = -1;
+    int result = WSAIoctl(fd,
+                          SIO_LOOPBACK_FAST_PATH,
+                          &enabled,
+                          sizeof(enabled),
+                          NULL,
+                          0,
+                          &result_byte_count,
+                          NULL,
+                          NULL);
+    return result == SOCKET_ERROR ? WSAGetLastError() : 0;
+}
+
 /* If address types is IPv6, then IPv6 must be available. Otherwise
  * no address can be generated. In the case of an IPv4 Inetaddress this
  * method will return an IPv4 mapped address where IPv6 is available and
diff -r f3be45662150 src/windows/native/sun/nio/ch/Net.c
--- a/src/windows/native/sun/nio/ch/Net.c	Tue Jan 06 13:32:22 2015 -0800
+++ b/src/windows/native/sun/nio/ch/Net.c	Mon Jan 19 16:05:16 2015 +0300
@@ -126,7 +126,7 @@
 
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
-                            jboolean stream, jboolean reuse)
+                            jboolean stream, jboolean reuse, jboolean fastLoopback)
 {
     SOCKET s;
     int domain = (preferIPv6) ? AF_INET6 : AF_INET;
@@ -151,6 +151,38 @@
         NET_ThrowNew(env, WSAGetLastError(), "socket");
     }
 
+    if (stream && fastLoopback) {
+        static int loopback_available = 1;
+        if (loopback_available) {
+            int rv = NET_EnableFastTcpLoopback((jint)s);
+            if (rv) {
+                if (rv == WSAEOPNOTSUPP) {
+                    // SIO_LOOPBACK_FAST_PATH command is not supported
+                    // Remember this and don't call it in future
+                    loopback_available = 0;
+                } else {
+                    // Get OS version once, at the first call
+                    static int ver_initialized = 0;
+                    static OSVERSIONINFO ver;
+                    if (!ver_initialized) {
+                        ver_initialized = 1;
+                        ver.dwOSVersionInfoSize = sizeof(ver);
+                        GetVersionEx(&ver);
+                    }
+                    
+                    // if os < Win8 (kernel 6.2) SIO_LOOPBACK_FAST_PATH is not supported
+                    if ((ver.dwMajorVersion < 6) || 
+                        (ver.dwMajorVersion == 6 && ver.dwMinorVersion < 2)) {
+                        loopback_available = 0;
+                    } else {
+                        // OS version is OK but the command failed
+                        NET_ThrowNew(env, rv, "fastLoopback");
+                    }
+                }
+            }
+        }
+    }
+
     return (jint)s;
 }
 
diff -r f3be45662150 test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java
--- a/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java	Tue Jan 06 13:32:22 2015 -0800
+++ b/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java	Mon Jan 19 16:05:16 2015 +0300
@@ -24,6 +24,8 @@
 /* @test
  * @bug 6834246 6842687
  * @summary Stress test connections through the loopback interface
+ * @run main StressLoopback
+ * @run main/othervm -Djdk.net.useFastTcpLoopback StressLoopback
  */
 
 import java.nio.ByteBuffer;
