< prev index next >
test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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.
@@ -47,10 +47,13 @@
public static void main(String[] args) throws IOException {
ServerSocketChannel ssc = ServerSocketChannel.open();
// check supported options
Set<SocketOption<?>> options = ssc.supportedOptions();
+ boolean quickAck = options.contains(jdk.net.ExtendedSocketOptions.SO_QUICKACK);
+ if (!options.contains(jdk.net.ExtendedSocketOptions.SO_QUICKACK) && quickAck)
+ throw new RuntimeException("SO_REUSEPORT should be supported");
if (!options.contains(SO_REUSEADDR))
throw new RuntimeException("SO_REUSEADDR should be supported");
if (!options.contains(SO_RCVBUF))
throw new RuntimeException("SO_RCVBUF should be supported");
@@ -63,10 +66,17 @@
ssc.setOption(SO_REUSEADDR, true);
checkOption(ssc, SO_REUSEADDR, true);
ssc.setOption(SO_REUSEADDR, false);
checkOption(ssc, SO_REUSEADDR, false);
+ if (quickAck) {
+ ssc.setOption(jdk.net.ExtendedSocketOptions.SO_QUICKACK, true);
+ checkOption(ssc, jdk.net.ExtendedSocketOptions.SO_QUICKACK, true);
+ ssc.setOption(jdk.net.ExtendedSocketOptions.SO_QUICKACK, false);
+ checkOption(ssc, jdk.net.ExtendedSocketOptions.SO_QUICKACK, false);
+ }
+
// NullPointerException
try {
ssc.setOption(null, "value");
throw new RuntimeException("NullPointerException not thrown");
} catch (NullPointerException x) {
< prev index next >