< prev index next >
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -35,10 +35,11 @@
import java.util.Random;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.io.Closeable;
import java.io.IOException;
+import java.util.Set;
public class Basic {
static final Random rand = new Random();
static boolean skipSlowConnectTest = false;
@@ -163,10 +164,23 @@
throw new RuntimeException("SO_KEEPALIVE did not change");
// read others (can't check as actual value is implementation dependent)
ch.getOption(SO_RCVBUF);
ch.getOption(SO_SNDBUF);
+
+ Set<SocketOption<?>> options = ch.supportedOptions();
+ boolean quickAck = options.contains(jdk.net.ExtendedSocketOptions.SO_QUICKACK);
+ if (quickAck) {
+ if (ch.getOption(jdk.net.ExtendedSocketOptions.SO_QUICKACK)) {
+ throw new RuntimeException("Default of SO_QUICKACK should be 'false'");
+ }
+
+ if (!ch.setOption(jdk.net.ExtendedSocketOptions.SO_QUICKACK, true).
+ getOption(jdk.net.ExtendedSocketOptions.SO_QUICKACK)) {
+ throw new RuntimeException("SO_QUICKACK did not change");
+ }
+ }
}
}
static void testConnect() throws Exception {
System.out.println("-- connect --");
< prev index next >