use of com.sun.nio.sctp.SctpChannel in project jdk8u_jdk by JetBrains.
the class NonBlockingAccept method doClient.
void doClient(SocketAddress peerAddress) {
Set<SctpChannel> channels = new HashSet<SctpChannel>(NUM_TEST_CONNECTIONS);
try {
for (int i = 0; i < NUM_TEST_CONNECTIONS; ) {
debug("connecting " + ++i);
channels.add(SctpChannel.open(peerAddress, 0, 0));
sleep(100);
}
/* don't close the channels until they have been accepted */
acceptLatch.await();
for (SctpChannel sc : channels) sc.close();
} catch (IOException ioe) {
unexpected(ioe);
} catch (InterruptedException ie) {
unexpected(ie);
}
}
use of com.sun.nio.sctp.SctpChannel in project jdk8u_jdk by JetBrains.
the class Accept method doClient.
void doClient(SocketAddress peerAddress) {
SctpChannel channel = null;
try {
channel = SctpChannel.open(peerAddress, 0, 0);
acceptLatch.await();
/* for test 4 */
closeByIntLatch.await();
sleep(500);
server.thread().interrupt();
/* for test 5 */
asyncCloseLatch.await();
sleep(500);
server.channel().close();
/* wait for the server thread to finish */
join(server.thread(), 10000);
} catch (IOException ioe) {
unexpected(ioe);
} catch (InterruptedException ie) {
unexpected(ie);
} finally {
try {
if (channel != null)
channel.close();
} catch (IOException e) {
unexpected(e);
}
}
}
Aggregations