/*
* 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 Branch {
/* 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 {
/* setup an association implicitly by sending a small message */
int streamNumber = 0;
"buffers position should have been incremented by sent");
/* Receive the COMM_UP */
/* TEST 1: branch */
"branched channel should be bound");
"branched channel should be connected");
"there should be no associations since the only one was branched off");
"message not sent on the correct stream");
length, "bytes received not equal to message length");
"received message not the same as sent message");
} 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");
} catch (IOException ioe) {
} catch (InterruptedException ie) {
unexpected(ie);
} finally {
catch (IOException unused) {}
}
}
}
{
boolean receivedCommUp() {
return receivedCommUp;
}
debug("AssociationChangeNotification");
receivedCommUp = true;
return HandlerResult.RETURN;
}
/* A ShutdownNotification handler is provided to ensure that no
* shutdown notification are being handled since we don't expect
* to receive them. This is not part of branch testing, it just
* fits here to test another bug. */
debug("ShutdownNotification");
fail("Shutdown should not be received");
return HandlerResult.RETURN;
}
}
//--------------------- Infrastructure ---------------------------
boolean debug = true;
}