/*
 * Copyright 2013 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.channel.sctp;

import io.netty.channel.ChannelOption;

import java.net.SocketAddress;
import java.util.List;

/**
 * Option for configuring the SCTP transport
 */
public class SctpChannelOption<T> extends ChannelOption<T> {
    public static final SctpChannelOption<Boolean> SCTP_DISABLE_FRAGMENTS =
            new SctpChannelOption<Boolean>("SCTP_DISABLE_FRAGMENTS");
    public static final SctpChannelOption<Boolean> SCTP_EXPLICIT_COMPLETE =
            new SctpChannelOption<Boolean>("SCTP_EXPLICIT_COMPLETE");
    public static final SctpChannelOption<Integer> SCTP_FRAGMENT_INTERLEAVE =
            new SctpChannelOption<Integer>("SCTP_FRAGMENT_INTERLEAVE");
    public static final SctpChannelOption<List<Integer>> SCTP_INIT_MAXSTREAMS =
            new SctpChannelOption<List<Integer>>("SCTP_INIT_MAXSTREAMS") {
                @Override
                public void validate(List<Integer> value) {
                    super.validate(value);
                    if (value.size() != 2) {
                        throw new IllegalArgumentException("value must be a List of 2 Integers: " + value);
                    }
                    if (value.get(0) == null) {
                        throw new NullPointerException("value[0]");
                    }
                    if (value.get(1) == null) {
                        throw new NullPointerException("value[1]");
                    }
                }
            };

    public static final SctpChannelOption<Boolean> SCTP_NODELAY =
            new SctpChannelOption<Boolean>("SCTP_NODELAY");
    public static final SctpChannelOption<SocketAddress> SCTP_PRIMARY_ADDR =
            new SctpChannelOption<SocketAddress>("SCTP_PRIMARY_ADDR");
    public static final SctpChannelOption<SocketAddress> SCTP_SET_PEER_PRIMARY_ADDR =
            new SctpChannelOption<SocketAddress>("SCTP_SET_PEER_PRIMARY_ADDR");

    protected SctpChannelOption(String name) {
        super(name);
    }
}

@@ -658,16 +658,67 @@
 .sctp;%0A%0A
+import com.sun.nio.sctp.SctpStandardSocketOptions;%0A
 import i
@@ -748,16 +748,16 @@
 Option;%0A
-
 %0Aimport 
@@ -783,31 +783,8 @@
 ess;
-%0Aimport java.util.List;
 %0A%0A/*
@@ -1379,29 +1379,56 @@
 lOption%3C
-List%3CInteger%3E
+SctpStandardSocketOptions.InitMaxStreams
 %3E SCTP_I
@@ -1482,660 +1482,73 @@
 ion%3C
-List%3CInteger%3E%3E(%22SCTP_INIT_MAXSTREAMS%22) %7B%0A                @Override%0A                public void validate(List%3CInteger%3E value) %7B%0A                    super.validate(value);%0A                    if (value.size() != 2) %7B%0A                        throw new IllegalArgumentException(%22value must be a List of 2 Integers: %22 + value);%0A                    %7D%0A                    if (value.get(0) == null) %7B%0A                        throw new NullPointerException(%22value%5B0%5D%22);%0A                    %7D%0A                    if (value.get(1) == null) %7B%0A                        throw new NullPointerException(%22value%5B1%5D%22);%0A                    %7D%0A                %7D%0A            %7D
+SctpStandardSocketOptions.InitMaxStreams%3E(%22SCTP_INIT_MAXSTREAMS%22)
 ;%0A%0A 

Fix ClassCastException by using the correct type for SCTP_INIT_MAXSTREAMS