test/jdk/com/sun/nio/sctp/SctpChannel/Connect.java
changeset 59205 afcc8af048e6
parent 47216 71c04702a3d5
equal deleted inserted replaced
59204:7b10581e9632 59205:afcc8af048e6
    59         doTest();
    59         doTest();
    60     }
    60     }
    61 
    61 
    62     void doTest() {
    62     void doTest() {
    63         SctpChannel channel = null;
    63         SctpChannel channel = null;
    64         SctpServerChannel ssc = null;
    64 
    65 
    65         try (SctpServerChannel ssc = SctpServerChannel.open()) {
    66         try {
       
    67             /* Create a server channel to connect to */
    66             /* Create a server channel to connect to */
    68             ssc = SctpServerChannel.open().bind(null);
    67             ssc.bind(null);
    69             Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
    68             Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
    70             if (addrs.isEmpty())
    69             if (addrs.isEmpty())
    71                 debug("addrs should not be empty");
    70                 debug("addrs should not be empty");
    72             final SocketAddress peerAddress = (InetSocketAddress) addrs.iterator().next();
    71             final SocketAddress peerAddress = (InetSocketAddress) addrs.iterator().next();
    73 
    72 
   206 
   205 
   207         } catch (IOException ioe) {
   206         } catch (IOException ioe) {
   208             unexpected(ioe);
   207             unexpected(ioe);
   209         } finally {
   208         } finally {
   210             try { if (channel != null) channel.close(); }
   209             try { if (channel != null) channel.close(); }
   211             catch (IOException unused) {}
       
   212             try { if (ssc != null) ssc.close(); }
       
   213             catch (IOException unused) {}
   210             catch (IOException unused) {}
   214         }
   211         }
   215     }
   212     }
   216 
   213 
   217     class UnsupportedSocketAddress extends SocketAddress { }
   214     class UnsupportedSocketAddress extends SocketAddress { }