<commit_before>/*
 * Copyright 2011 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.testsuite.util;

import java.util.Locale;

public class SctpTestUtil {
    //io.netty.util.SocketAddresses.LOCALHOST interface has MTU SIZE issues with SCTP, we have  to use local loop back interface for testing
    public final static String LOOP_BACK = "127.0.0.1";
    public final static String LOOP_BACK2 = "127.0.0.2";
    
    /**
     * Return <code>true</code> if SCTP is supported by the running os.
     * 
     */
    public static boolean isSctpSupported() {
        String os = System.getProperty("os.name").toLowerCase(Locale.UK);
        if (os.equals("unix") || os.equals("linux") || os.equals("sun") || os.equals("solaris")) {<commit_msg>Also handle the case of missing shared lib for sctp<commit_after>/*
 * Copyright 2011 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.testsuite.util;

import java.io.IOException;
import java.util.Locale;

import com.sun.nio.sctp.SctpChannel;

public class SctpTestUtil {
    //io.netty.util.SocketAddresses.LOCALHOST interface has MTU SIZE issues with SCTP, we have  to use local loop back interface for testing
    public final static String LOOP_BACK = "127.0.0.1";
    public final static String LOOP_BACK2 = "127.0.0.2";
    
    /**
     * Return <code>true</code> if SCTP is supported by the running os.
     * 
     */
    public static boolean isSctpSupported() {
        String os = System.getProperty("os.name").toLowerCase(Locale.UK);
        if (os.equals("unix") || os.equals("linux") || os.equals("sun") || os.equals("solaris")) {
            try {
                SctpChannel.open();
            } catch (IOException e) {
                // ignore
            } catch (UnsupportedOperationException e) {
                // This exception may get thrown if the OS does not have
                // the shared libs installed.
                System.out.print("Not supported: " + e.getMessage());
                return false;
                
            }

{'fraction_non_alphanumeric': 0.09586881110059918, 'fraction_numerical': 0.013245033112582781, 'mean_word_length': 2.868292682926829, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6441359', 'n_tokens_mistral': 890, 'n_tokens_neox': 868, 'n_words': 342}