From 128309367cd0c295947eb27b830c43639b9eb705 Mon Sep 17 00:00:00 2001 From: norman Date: Tue, 22 May 2012 09:36:14 +0200 Subject: [PATCH] Also handle the case of missing shared lib for sctp --- .../io/netty/testsuite/util/SctpTestUtil.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/transport-sctp/src/test/java/io/netty/testsuite/util/SctpTestUtil.java b/transport-sctp/src/test/java/io/netty/testsuite/util/SctpTestUtil.java index 5a3b3abd63..6497a1e428 100644 --- a/transport-sctp/src/test/java/io/netty/testsuite/util/SctpTestUtil.java +++ b/transport-sctp/src/test/java/io/netty/testsuite/util/SctpTestUtil.java @@ -15,8 +15,11 @@ */ 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"; @@ -29,6 +32,18 @@ public class SctpTestUtil { 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; + + } + return true; } return false;