/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 4927640
* @summary Tests the SCTP protocol implementation
* @author chegar
*/
public class Send {
/* Latches used to synchronize between the client and server so that
* connections without any IO may not be closed without being accepted */
if (!Util.isSCTPSupported()) {
return;
}
/* requested to connecct to a specific address */
try {
} catch (NumberFormatException nfe) {
}
} else {
/* start server on local machine, default */
try {
} catch (IOException ioe) {
return;
}
}
}
try {
/* TEST 1: send small message */
int streamNumber = 0;
"buffers position should have been incremented by sent");
/* TEST 2: receive the echoed message */
"message not sent on the correct stream");
length, "bytes received not equal to message length");
"received message not the same as sent message");
/* TEST 3: send large message */
"buffers position should have been incremented by sent");
/* TEST 4: receive the echoed message */
"message not sent on the correct stream");
length, "bytes received not equal to message length");
"received message not the same as sent message");
/* TEST 5: InvalidStreamExcepton */
try {
fail("should have thrown InvalidStreamExcepton");
} catch (InvalidStreamException ise){
pass();
} catch (IOException ioe) {
}
"remaining should not be changed");
"buffers position should not be changed");
/* TEST 5: getRemoteAddresses(Association) */
/* TEST 6: Send from heap buffer to force implementation to
* substitute with a native buffer, then check that its position
* is updated correctly */
final int offset = 1;
try {
"buffers position should have been incremented by sent");
} catch (IllegalArgumentException iae) {
}
} catch (IOException ioe) {
} finally {
catch (IOException e) { unexpected (e);}
}
}
}
{
debug("addrs should not be empty");
}
public void start() {
}
return serverAddr;
}
public void run() {
try {
/* receive a small message */
do {
fail("Server: unexpected null from receive");
return;
}
} while (!info.isComplete());
"message not sent on the correct stream");
length, "bytes received not equal to message length");
"received message not the same as sent message");
/* echo the message */
debug("Server: echoing first message");
/* receive a large message */
do {
fail("Server: unexpected null from receive");
return;
}
} while (!info.isComplete());
"message not sent on the correct stream");
length, "bytes received not equal to message length");
"received message not the same as sent message");
/* echo the message */
debug("Server: echoing second message");
/* TEST 6 */
final int offset = 1;
do {
fail("Server: unexpected null from receive");
return;
}
} while (!info.isComplete());
"bytes received not equal to message length");
"received message not the same as sent message");
} catch (IOException ioe) {
} catch (InterruptedException ie) {
unexpected(ie);
} finally {
catch (IOException unused) {}
}
}
}
//--------------------- Infrastructure ---------------------------
boolean debug = true;
}