test/jdk/java/net/SocketImpl/ImplSupportedOptions.java
author phedlin
Fri, 15 Nov 2019 16:39:08 +0100
changeset 59291 54cf02d52c1b
parent 52456 90ff0e286a5e
permissions -rw-r--r--
8220376: C2: Int >0 not recognized as !=0 for div by 0 check Reviewed-by: neliasso, vlivanov, mdoerr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52456
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
     1
/*
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
     4
 *
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
     8
 *
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    13
 * accompanied this code).
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    14
 *
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    18
 *
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    21
 * questions.
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    22
 */
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    23
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    24
/*
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    25
 * @test
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    26
 * @bug 8213418
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    27
 * @summary Ensure correct impl supported socket options
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    28
 * @run testng ImplSupportedOptions
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    29
 */
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    30
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    31
import java.io.IOException;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    32
import java.io.InputStream;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    33
import java.io.OutputStream;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    34
import java.net.InetAddress;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    35
import java.net.ServerSocket;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    36
import java.net.Socket;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    37
import java.net.SocketAddress;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    38
import java.net.SocketException;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    39
import java.net.SocketImpl;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    40
import java.net.SocketOption;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    41
import java.net.StandardSocketOptions;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    42
import java.util.Set;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    43
import org.testng.annotations.Test;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    44
import static org.testng.Assert.assertEquals;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    45
import static org.testng.Assert.assertTrue;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    46
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    47
public class ImplSupportedOptions {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    48
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    49
    @Test
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    50
    public void socketSupportedOptions() throws Exception {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    51
        Socket s = new Socket();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    52
        Set<?> standardOptions = s.supportedOptions();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    53
        assertTrue(standardOptions.contains(StandardSocketOptions.SO_LINGER),
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    54
                   "Expected SO_LINGER, in:" + standardOptions);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    55
        assertEquals(standardOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    56
        assertEquals(standardOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    57
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    58
        s = new DummySocket();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    59
        Set<?> dummyOptions = s.supportedOptions();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    60
        assertEquals(dummyOptions.size(), 1);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    61
        assertTrue(dummyOptions.contains(DummySocketImpl.SOCKET_OPT));
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    62
        assertEquals(dummyOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    63
        assertEquals(dummyOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    64
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    65
        s = new Socket();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    66
        standardOptions = s.supportedOptions();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    67
        assertTrue(standardOptions.contains(StandardSocketOptions.SO_LINGER),
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    68
                   "Expected SO_LINGER, in:" + standardOptions);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    69
        assertEquals(standardOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    70
        assertEquals(standardOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    71
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    72
        s = new DummySocket();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    73
        dummyOptions = s.supportedOptions();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    74
        assertEquals(dummyOptions.size(), 1);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    75
        assertTrue(dummyOptions.contains(DummySocketImpl.SOCKET_OPT));
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    76
        assertEquals(dummyOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    77
        assertEquals(dummyOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    78
    }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    79
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    80
    @Test
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    81
    public void serverSocketSupportedOptions() throws Exception {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    82
        ServerSocket s = new ServerSocket();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    83
        Set<?> standardOptions = s.supportedOptions();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    84
        assertTrue(standardOptions.contains(StandardSocketOptions.SO_REUSEADDR),
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    85
                   "Expected SO_REUSEADDR, in:" + standardOptions);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    86
        assertEquals(standardOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    87
        assertEquals(standardOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    88
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    89
        s = new DummyServerSocket();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    90
        Set<?> dummyOptions = s.supportedOptions();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    91
        assertEquals(dummyOptions.size(), 1);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    92
        assertTrue(dummyOptions.contains(DummySocketImpl.SOCKET_OPT));
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    93
        assertEquals(dummyOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    94
        assertEquals(dummyOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    95
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    96
        s = new ServerSocket();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    97
        standardOptions = s.supportedOptions();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    98
        assertTrue(standardOptions.contains(StandardSocketOptions.SO_REUSEADDR),
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
    99
                   "Expected SO_REUSEADDR, in:" + standardOptions);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   100
        assertEquals(standardOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   101
        assertEquals(standardOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   102
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   103
        s = new DummyServerSocket();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   104
        dummyOptions = s.supportedOptions();
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   105
        assertEquals(dummyOptions.size(), 1);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   106
        assertTrue(dummyOptions.contains(DummySocketImpl.SOCKET_OPT));
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   107
        assertEquals(dummyOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   108
        assertEquals(dummyOptions, s.supportedOptions());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   109
    }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   110
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   111
    static class DummySocket extends Socket {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   112
        DummySocket() throws IOException  {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   113
            super(new DummySocketImpl());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   114
        }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   115
    }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   116
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   117
    static class DummyServerSocket extends ServerSocket {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   118
        DummyServerSocket() throws IOException  {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   119
            super(new DummySocketImpl());
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   120
        }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   121
    }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   122
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   123
    static class DummySocketImpl extends SocketImpl {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   124
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   125
        public static final SocketOption<String> SOCKET_OPT =
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   126
                new ImplSocketOption<>("SOCKET_OPT", String.class);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   127
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   128
        private static class ImplSocketOption<T> implements SocketOption<T> {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   129
            private final String name;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   130
            private final Class<T> type;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   131
            ImplSocketOption(String name, Class<T> type) {
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   132
                this.name = name;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   133
                this.type = type;
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   134
            }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   135
            @Override public String name() { return name; }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   136
            @Override public Class<T> type() { return type; }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   137
            @Override public String toString() { return name; }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   138
        }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   139
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   140
        private final Set<SocketOption<?>> SO = Set.of(SOCKET_OPT);
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   141
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   142
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   143
        public Set<SocketOption<?>> supportedOptions() { return SO; }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   144
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   145
        // ---
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   146
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   147
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   148
        protected void create(boolean stream) throws IOException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   149
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   150
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   151
        protected void connect(String host, int port) throws IOException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   152
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   153
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   154
        protected void connect(InetAddress address, int port) throws IOException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   155
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   156
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   157
        protected void connect(SocketAddress address, int timeout) throws IOException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   158
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   159
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   160
        protected void bind(InetAddress host, int port) throws IOException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   161
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   162
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   163
        protected void listen(int backlog) throws IOException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   164
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   165
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   166
        protected void accept(SocketImpl s) throws IOException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   167
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   168
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   169
        protected InputStream getInputStream() throws IOException { return null; }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   170
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   171
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   172
        protected OutputStream getOutputStream() throws IOException { return null; }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   173
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   174
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   175
        protected int available() throws IOException { return 0; }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   176
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   177
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   178
        protected void close() throws IOException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   179
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   180
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   181
        protected void sendUrgentData(int data) throws IOException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   182
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   183
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   184
        public void setOption(int optID, Object value) throws SocketException { }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   185
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   186
        @Override
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   187
        public Object getOption(int optID) throws SocketException { return null; }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   188
    }
90ff0e286a5e 8213418: Socket/ServerSocket supportedOptions does not work with custom SocketImpl
chegar
parents:
diff changeset
   189
}