Java Code Examples for com.sun.nio.sctp.MessageInfo#createOutgoing()
The following examples show how to use
com.sun.nio.sctp.MessageInfo#createOutgoing() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageInfoTests.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 2
Source File: MessageInfoTests.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 3
Source File: MessageInfoTests.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 4
Source File: MessageInfoTests.java From hottub with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 5
Source File: MessageInfoTests.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 6
Source File: MessageInfoTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 7
Source File: MessageInfoTests.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 8
Source File: MessageInfoTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 9
Source File: MessageInfoTests.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 10
Source File: MessageInfoTests.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 11
Source File: MessageInfoTests.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
void test(String[] args) { /* TEST 1 : createOutGoing(SocketAddress,int) */ MessageInfo info = MessageInfo.createOutgoing(addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); checkGetterSetters(info); /* TEST 2 : createOutGoing(Association,SocketAddress,int) */ info = MessageInfo.createOutgoing(assoc, addr, DEFAULT_STREAM_NUMBER); checkDefaults(info); check(info.association().equals(assoc), "incorrect association"); checkGetterSetters(info); /* TEST 3: null values */ info = MessageInfo.createOutgoing(null, 0); check(info.address() == null, "address should be null"); check(info.association() == null, "association should be null"); info = MessageInfo.createOutgoing(assoc, null, 0); check(info.address() == null, "address should be null"); /* Test 4: IllegalArgumentException */ testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(addr, 65537); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(null, addr, 0); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, -1); } }); testIAE(new Runnable() { public void run() { MessageInfo.createOutgoing(assoc, addr, 65537);}}); final MessageInfo iaeInfo = MessageInfo.createOutgoing(assoc, addr, 0); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(-1); } }); testIAE(new Runnable() { public void run() { iaeInfo.streamNumber(65537); } }); }
Example 12
Source File: Branch.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
void doTest(SocketAddress peerAddress) { SctpMultiChannel channel = null; ByteBuffer buffer = ByteBuffer.allocate(Util.LARGE_BUFFER); MessageInfo info = MessageInfo.createOutgoing(null, 0); try { channel = SctpMultiChannel.open(); /* setup an association implicitly by sending a small message */ int streamNumber = 0; debug("sending to " + peerAddress + " on stream number: " + streamNumber); info = MessageInfo.createOutgoing(peerAddress, streamNumber); buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); buffer.flip(); int position = buffer.position(); int remaining = buffer.remaining(); debug("sending small message: " + buffer); int sent = channel.send(buffer, info); check(sent == remaining, "sent should be equal to remaining"); check(buffer.position() == (position + sent), "buffers position should have been incremented by sent"); /* Receive the COMM_UP */ buffer.clear(); BranchNotificationHandler handler = new BranchNotificationHandler(); info = channel.receive(buffer, null, handler); check(handler.receivedCommUp(), "COMM_UP no received"); Set<Association> associations = channel.associations(); check(!associations.isEmpty(),"There should be some associations"); Association bassoc = associations.iterator().next(); /* TEST 1: branch */ SctpChannel bchannel = channel.branch(bassoc); check(!bchannel.getAllLocalAddresses().isEmpty(), "branched channel should be bound"); check(!bchannel.getRemoteAddresses().isEmpty(), "branched channel should be connected"); check(channel.associations().isEmpty(), "there should be no associations since the only one was branched off"); buffer.clear(); info = bchannel.receive(buffer, null, null); buffer.flip(); check(info != null, "info is null"); check(info.streamNumber() == streamNumber, "message not sent on the correct stream"); check(info.bytes() == Util.SMALL_MESSAGE.getBytes("ISO-8859-1"). length, "bytes received not equal to message length"); check(info.bytes() == buffer.remaining(), "bytes != remaining"); check(Util.compare(buffer, Util.SMALL_MESSAGE), "received message not the same as sent message"); } catch (IOException ioe) { unexpected(ioe); } finally { clientFinishedLatch.countDown(); try { serverFinishedLatch.await(10L, TimeUnit.SECONDS); } catch (InterruptedException ie) { unexpected(ie); } if (channel != null) { try { channel.close(); } catch (IOException e) { unexpected (e);} } } }
Example 13
Source File: Branch.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
void doTest(SocketAddress peerAddress) { SctpMultiChannel channel = null; ByteBuffer buffer = ByteBuffer.allocate(Util.LARGE_BUFFER); MessageInfo info = MessageInfo.createOutgoing(null, 0); try { channel = SctpMultiChannel.open(); /* setup an association implicitly by sending a small message */ int streamNumber = 0; debug("sending to " + peerAddress + " on stream number: " + streamNumber); info = MessageInfo.createOutgoing(peerAddress, streamNumber); buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); buffer.flip(); int position = buffer.position(); int remaining = buffer.remaining(); debug("sending small message: " + buffer); int sent = channel.send(buffer, info); check(sent == remaining, "sent should be equal to remaining"); check(buffer.position() == (position + sent), "buffers position should have been incremented by sent"); /* Receive the COMM_UP */ buffer.clear(); BranchNotificationHandler handler = new BranchNotificationHandler(); info = channel.receive(buffer, null, handler); check(handler.receivedCommUp(), "COMM_UP no received"); Set<Association> associations = channel.associations(); check(!associations.isEmpty(),"There should be some associations"); Association bassoc = associations.iterator().next(); /* TEST 1: branch */ SctpChannel bchannel = channel.branch(bassoc); check(!bchannel.getAllLocalAddresses().isEmpty(), "branched channel should be bound"); check(!bchannel.getRemoteAddresses().isEmpty(), "branched channel should be connected"); check(channel.associations().isEmpty(), "there should be no associations since the only one was branched off"); buffer.clear(); info = bchannel.receive(buffer, null, null); buffer.flip(); check(info != null, "info is null"); check(info.streamNumber() == streamNumber, "message not sent on the correct stream"); check(info.bytes() == Util.SMALL_MESSAGE.getBytes("ISO-8859-1"). length, "bytes received not equal to message length"); check(info.bytes() == buffer.remaining(), "bytes != remaining"); check(Util.compare(buffer, Util.SMALL_MESSAGE), "received message not the same as sent message"); } catch (IOException ioe) { unexpected(ioe); } finally { clientFinishedLatch.countDown(); try { serverFinishedLatch.await(10L, TimeUnit.SECONDS); } catch (InterruptedException ie) { unexpected(ie); } if (channel != null) { try { channel.close(); } catch (IOException e) { unexpected (e);} } } }
Example 14
Source File: Branch.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
void doTest(SocketAddress peerAddress) { SctpMultiChannel channel = null; ByteBuffer buffer = ByteBuffer.allocate(Util.LARGE_BUFFER); MessageInfo info = MessageInfo.createOutgoing(null, 0); try { channel = SctpMultiChannel.open(); /* setup an association implicitly by sending a small message */ int streamNumber = 0; debug("sending to " + peerAddress + " on stream number: " + streamNumber); info = MessageInfo.createOutgoing(peerAddress, streamNumber); buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); buffer.flip(); int position = buffer.position(); int remaining = buffer.remaining(); debug("sending small message: " + buffer); int sent = channel.send(buffer, info); check(sent == remaining, "sent should be equal to remaining"); check(buffer.position() == (position + sent), "buffers position should have been incremented by sent"); /* Receive the COMM_UP */ buffer.clear(); BranchNotificationHandler handler = new BranchNotificationHandler(); info = channel.receive(buffer, null, handler); check(handler.receivedCommUp(), "COMM_UP no received"); Set<Association> associations = channel.associations(); check(!associations.isEmpty(),"There should be some associations"); Association bassoc = associations.iterator().next(); /* TEST 1: branch */ SctpChannel bchannel = channel.branch(bassoc); check(!bchannel.getAllLocalAddresses().isEmpty(), "branched channel should be bound"); check(!bchannel.getRemoteAddresses().isEmpty(), "branched channel should be connected"); check(channel.associations().isEmpty(), "there should be no associations since the only one was branched off"); buffer.clear(); info = bchannel.receive(buffer, null, null); buffer.flip(); check(info != null, "info is null"); check(info.streamNumber() == streamNumber, "message not sent on the correct stream"); check(info.bytes() == Util.SMALL_MESSAGE.getBytes("ISO-8859-1"). length, "bytes received not equal to message length"); check(info.bytes() == buffer.remaining(), "bytes != remaining"); check(Util.compare(buffer, Util.SMALL_MESSAGE), "received message not the same as sent message"); } catch (IOException ioe) { unexpected(ioe); } finally { clientFinishedLatch.countDown(); try { serverFinishedLatch.await(10L, TimeUnit.SECONDS); } catch (InterruptedException ie) { unexpected(ie); } if (channel != null) { try { channel.close(); } catch (IOException e) { unexpected (e);} } } }
Example 15
Source File: Branch.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
void doTest(SocketAddress peerAddress) { SctpMultiChannel channel = null; ByteBuffer buffer = ByteBuffer.allocate(Util.LARGE_BUFFER); MessageInfo info = MessageInfo.createOutgoing(null, 0); try { channel = SctpMultiChannel.open(); /* setup an association implicitly by sending a small message */ int streamNumber = 0; debug("sending to " + peerAddress + " on stream number: " + streamNumber); info = MessageInfo.createOutgoing(peerAddress, streamNumber); buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); buffer.flip(); int position = buffer.position(); int remaining = buffer.remaining(); debug("sending small message: " + buffer); int sent = channel.send(buffer, info); check(sent == remaining, "sent should be equal to remaining"); check(buffer.position() == (position + sent), "buffers position should have been incremented by sent"); /* Receive the COMM_UP */ buffer.clear(); BranchNotificationHandler handler = new BranchNotificationHandler(); info = channel.receive(buffer, null, handler); check(handler.receivedCommUp(), "COMM_UP no received"); Set<Association> associations = channel.associations(); check(!associations.isEmpty(),"There should be some associations"); Association bassoc = associations.iterator().next(); /* TEST 1: branch */ SctpChannel bchannel = channel.branch(bassoc); check(!bchannel.getAllLocalAddresses().isEmpty(), "branched channel should be bound"); check(!bchannel.getRemoteAddresses().isEmpty(), "branched channel should be connected"); check(channel.associations().isEmpty(), "there should be no associations since the only one was branched off"); buffer.clear(); info = bchannel.receive(buffer, null, null); buffer.flip(); check(info != null, "info is null"); check(info.streamNumber() == streamNumber, "message not sent on the correct stream"); check(info.bytes() == Util.SMALL_MESSAGE.getBytes("ISO-8859-1"). length, "bytes received not equal to message length"); check(info.bytes() == buffer.remaining(), "bytes != remaining"); check(Util.compare(buffer, Util.SMALL_MESSAGE), "received message not the same as sent message"); } catch (IOException ioe) { unexpected(ioe); } finally { clientFinishedLatch.countDown(); try { serverFinishedLatch.await(10L, TimeUnit.SECONDS); } catch (InterruptedException ie) { unexpected(ie); } if (channel != null) { try { channel.close(); } catch (IOException e) { unexpected (e);} } } }
Example 16
Source File: Branch.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
void doTest(SocketAddress peerAddress) { SctpMultiChannel channel = null; ByteBuffer buffer = ByteBuffer.allocate(Util.LARGE_BUFFER); MessageInfo info = MessageInfo.createOutgoing(null, 0); try { channel = SctpMultiChannel.open(); /* setup an association implicitly by sending a small message */ int streamNumber = 0; debug("sending to " + peerAddress + " on stream number: " + streamNumber); info = MessageInfo.createOutgoing(peerAddress, streamNumber); buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); buffer.flip(); int position = buffer.position(); int remaining = buffer.remaining(); debug("sending small message: " + buffer); int sent = channel.send(buffer, info); check(sent == remaining, "sent should be equal to remaining"); check(buffer.position() == (position + sent), "buffers position should have been incremented by sent"); /* Receive the COMM_UP */ buffer.clear(); BranchNotificationHandler handler = new BranchNotificationHandler(); info = channel.receive(buffer, null, handler); check(handler.receivedCommUp(), "COMM_UP no received"); Set<Association> associations = channel.associations(); check(!associations.isEmpty(),"There should be some associations"); Association bassoc = associations.iterator().next(); /* TEST 1: branch */ SctpChannel bchannel = channel.branch(bassoc); check(!bchannel.getAllLocalAddresses().isEmpty(), "branched channel should be bound"); check(!bchannel.getRemoteAddresses().isEmpty(), "branched channel should be connected"); check(channel.associations().isEmpty(), "there should be no associations since the only one was branched off"); buffer.clear(); info = bchannel.receive(buffer, null, null); buffer.flip(); check(info != null, "info is null"); check(info.streamNumber() == streamNumber, "message not sent on the correct stream"); check(info.bytes() == Util.SMALL_MESSAGE.getBytes("ISO-8859-1"). length, "bytes received not equal to message length"); check(info.bytes() == buffer.remaining(), "bytes != remaining"); check(Util.compare(buffer, Util.SMALL_MESSAGE), "received message not the same as sent message"); } catch (IOException ioe) { unexpected(ioe); } finally { clientFinishedLatch.countDown(); try { serverFinishedLatch.await(10L, TimeUnit.SECONDS); } catch (InterruptedException ie) { unexpected(ie); } if (channel != null) { try { channel.close(); } catch (IOException e) { unexpected (e);} } } }
Example 17
Source File: Branch.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
void doTest(SocketAddress peerAddress) { SctpMultiChannel channel = null; ByteBuffer buffer = ByteBuffer.allocate(Util.LARGE_BUFFER); MessageInfo info = MessageInfo.createOutgoing(null, 0); try { channel = SctpMultiChannel.open(); /* setup an association implicitly by sending a small message */ int streamNumber = 0; debug("sending to " + peerAddress + " on stream number: " + streamNumber); info = MessageInfo.createOutgoing(peerAddress, streamNumber); buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); buffer.flip(); int position = buffer.position(); int remaining = buffer.remaining(); debug("sending small message: " + buffer); int sent = channel.send(buffer, info); check(sent == remaining, "sent should be equal to remaining"); check(buffer.position() == (position + sent), "buffers position should have been incremented by sent"); /* Receive the COMM_UP */ buffer.clear(); BranchNotificationHandler handler = new BranchNotificationHandler(); info = channel.receive(buffer, null, handler); check(handler.receivedCommUp(), "COMM_UP no received"); Set<Association> associations = channel.associations(); check(!associations.isEmpty(),"There should be some associations"); Association bassoc = associations.iterator().next(); /* TEST 1: branch */ SctpChannel bchannel = channel.branch(bassoc); check(!bchannel.getAllLocalAddresses().isEmpty(), "branched channel should be bound"); check(!bchannel.getRemoteAddresses().isEmpty(), "branched channel should be connected"); check(channel.associations().isEmpty(), "there should be no associations since the only one was branched off"); buffer.clear(); info = bchannel.receive(buffer, null, null); buffer.flip(); check(info != null, "info is null"); check(info.streamNumber() == streamNumber, "message not sent on the correct stream"); check(info.bytes() == Util.SMALL_MESSAGE.getBytes("ISO-8859-1"). length, "bytes received not equal to message length"); check(info.bytes() == buffer.remaining(), "bytes != remaining"); check(Util.compare(buffer, Util.SMALL_MESSAGE), "received message not the same as sent message"); } catch (IOException ioe) { unexpected(ioe); } finally { clientFinishedLatch.countDown(); try { serverFinishedLatch.await(10L, TimeUnit.SECONDS); } catch (InterruptedException ie) { unexpected(ie); } if (channel != null) { try { channel.close(); } catch (IOException e) { unexpected (e);} } } }
Example 18
Source File: Branch.java From hottub with GNU General Public License v2.0 | 4 votes |
void doTest(SocketAddress peerAddress) { SctpMultiChannel channel = null; ByteBuffer buffer = ByteBuffer.allocate(Util.LARGE_BUFFER); MessageInfo info = MessageInfo.createOutgoing(null, 0); try { channel = SctpMultiChannel.open(); /* setup an association implicitly by sending a small message */ int streamNumber = 0; debug("sending to " + peerAddress + " on stream number: " + streamNumber); info = MessageInfo.createOutgoing(peerAddress, streamNumber); buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); buffer.flip(); int position = buffer.position(); int remaining = buffer.remaining(); debug("sending small message: " + buffer); int sent = channel.send(buffer, info); check(sent == remaining, "sent should be equal to remaining"); check(buffer.position() == (position + sent), "buffers position should have been incremented by sent"); /* Receive the COMM_UP */ buffer.clear(); BranchNotificationHandler handler = new BranchNotificationHandler(); info = channel.receive(buffer, null, handler); check(handler.receivedCommUp(), "COMM_UP no received"); Set<Association> associations = channel.associations(); check(!associations.isEmpty(),"There should be some associations"); Association bassoc = associations.iterator().next(); /* TEST 1: branch */ SctpChannel bchannel = channel.branch(bassoc); check(!bchannel.getAllLocalAddresses().isEmpty(), "branched channel should be bound"); check(!bchannel.getRemoteAddresses().isEmpty(), "branched channel should be connected"); check(channel.associations().isEmpty(), "there should be no associations since the only one was branched off"); buffer.clear(); info = bchannel.receive(buffer, null, null); buffer.flip(); check(info != null, "info is null"); check(info.streamNumber() == streamNumber, "message not sent on the correct stream"); check(info.bytes() == Util.SMALL_MESSAGE.getBytes("ISO-8859-1"). length, "bytes received not equal to message length"); check(info.bytes() == buffer.remaining(), "bytes != remaining"); check(Util.compare(buffer, Util.SMALL_MESSAGE), "received message not the same as sent message"); } catch (IOException ioe) { unexpected(ioe); } finally { clientFinishedLatch.countDown(); try { serverFinishedLatch.await(10L, TimeUnit.SECONDS); } catch (InterruptedException ie) { unexpected(ie); } if (channel != null) { try { channel.close(); } catch (IOException e) { unexpected (e);} } } }
Example 19
Source File: Branch.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
void doTest(SocketAddress peerAddress) { SctpMultiChannel channel = null; ByteBuffer buffer = ByteBuffer.allocate(Util.LARGE_BUFFER); MessageInfo info = MessageInfo.createOutgoing(null, 0); try { channel = SctpMultiChannel.open(); /* setup an association implicitly by sending a small message */ int streamNumber = 0; debug("sending to " + peerAddress + " on stream number: " + streamNumber); info = MessageInfo.createOutgoing(peerAddress, streamNumber); buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); buffer.flip(); int position = buffer.position(); int remaining = buffer.remaining(); debug("sending small message: " + buffer); int sent = channel.send(buffer, info); check(sent == remaining, "sent should be equal to remaining"); check(buffer.position() == (position + sent), "buffers position should have been incremented by sent"); /* Receive the COMM_UP */ buffer.clear(); BranchNotificationHandler handler = new BranchNotificationHandler(); info = channel.receive(buffer, null, handler); check(handler.receivedCommUp(), "COMM_UP no received"); Set<Association> associations = channel.associations(); check(!associations.isEmpty(),"There should be some associations"); Association bassoc = associations.iterator().next(); /* TEST 1: branch */ SctpChannel bchannel = channel.branch(bassoc); check(!bchannel.getAllLocalAddresses().isEmpty(), "branched channel should be bound"); check(!bchannel.getRemoteAddresses().isEmpty(), "branched channel should be connected"); check(channel.associations().isEmpty(), "there should be no associations since the only one was branched off"); buffer.clear(); info = bchannel.receive(buffer, null, null); buffer.flip(); check(info != null, "info is null"); check(info.streamNumber() == streamNumber, "message not sent on the correct stream"); check(info.bytes() == Util.SMALL_MESSAGE.getBytes("ISO-8859-1"). length, "bytes received not equal to message length"); check(info.bytes() == buffer.remaining(), "bytes != remaining"); check(Util.compare(buffer, Util.SMALL_MESSAGE), "received message not the same as sent message"); } catch (IOException ioe) { unexpected(ioe); } finally { clientFinishedLatch.countDown(); try { serverFinishedLatch.await(10L, TimeUnit.SECONDS); } catch (InterruptedException ie) { unexpected(ie); } if (channel != null) { try { channel.close(); } catch (IOException e) { unexpected (e);} } } }
Example 20
Source File: Branch.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
void doTest(SocketAddress peerAddress) { SctpMultiChannel channel = null; ByteBuffer buffer = ByteBuffer.allocate(Util.LARGE_BUFFER); MessageInfo info = MessageInfo.createOutgoing(null, 0); try { channel = SctpMultiChannel.open(); /* setup an association implicitly by sending a small message */ int streamNumber = 0; debug("sending to " + peerAddress + " on stream number: " + streamNumber); info = MessageInfo.createOutgoing(peerAddress, streamNumber); buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); buffer.flip(); int position = buffer.position(); int remaining = buffer.remaining(); debug("sending small message: " + buffer); int sent = channel.send(buffer, info); check(sent == remaining, "sent should be equal to remaining"); check(buffer.position() == (position + sent), "buffers position should have been incremented by sent"); /* Receive the COMM_UP */ buffer.clear(); BranchNotificationHandler handler = new BranchNotificationHandler(); info = channel.receive(buffer, null, handler); check(handler.receivedCommUp(), "COMM_UP no received"); Set<Association> associations = channel.associations(); check(!associations.isEmpty(),"There should be some associations"); Association bassoc = associations.iterator().next(); /* TEST 1: branch */ SctpChannel bchannel = channel.branch(bassoc); check(!bchannel.getAllLocalAddresses().isEmpty(), "branched channel should be bound"); check(!bchannel.getRemoteAddresses().isEmpty(), "branched channel should be connected"); check(channel.associations().isEmpty(), "there should be no associations since the only one was branched off"); buffer.clear(); info = bchannel.receive(buffer, null, null); buffer.flip(); check(info != null, "info is null"); check(info.streamNumber() == streamNumber, "message not sent on the correct stream"); check(info.bytes() == Util.SMALL_MESSAGE.getBytes("ISO-8859-1"). length, "bytes received not equal to message length"); check(info.bytes() == buffer.remaining(), "bytes != remaining"); check(Util.compare(buffer, Util.SMALL_MESSAGE), "received message not the same as sent message"); } catch (IOException ioe) { unexpected(ioe); } finally { clientFinishedLatch.countDown(); try { serverFinishedLatch.await(10L, TimeUnit.SECONDS); } catch (InterruptedException ie) { unexpected(ie); } if (channel != null) { try { channel.close(); } catch (IOException e) { unexpected (e);} } } }