/*
* 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 Shutdown {
if (!Util.isSCTPSupported()) {
return;
}
/* requested to connecct to a specific address */
try {
} catch (NumberFormatException nfe) {
}
} else {
/* start server on local machine, default */
try {
server = new ShutdownServer();
} catch (IOException ioe) {
return;
}
}
}
try {
/* TEST 1: Verify NotYetConnectedException thrown */
debug("Test 1: NotYetConnectedException");
try {
fail("shutdown not throwing expected NotYetConnectedException");
} catch (NotYetConnectedException unused) {
pass();
} catch (IOException ioe) {
}
/* TEST 2: receive data sent before shutdown */
do {
debug("Test 2: invoking receive");
fail("unexpected null from receive");
return;
}
} while (!info.isComplete());
length, "bytes received not equal to message length");
"received message not the same as sent message");
/* TEST 3: receive notifications on the SCTP stack */
debug("Test 3: receive notifications");
/* TEST 4: If the channel is already shutdown then invoking this
* method has no effect. */
debug("Test 4: no-op");
try {
pass();
} catch (IOException ioe) {
}
/* TEST 5: Further sends will throw ClosedChannelException */
debug("Test 5: ClosedChannelException");
try {
fail("shutdown not throwing expected ClosedChannelException");
} catch (ClosedChannelException unused) {
pass();
} catch (IOException ioe) {
}
/* TEST 6: getRemoteAddresses */
debug("Test 6: getRemoteAddresses");
try {
"A shutdown channel should not have remote addresses");
} catch (IOException ioe) {
}
} catch (IOException ioe) {
} catch (InterruptedException ie) {
unexpected(ie);
}finally {
catch (IOException e) { unexpected(e);}
}
}
{
//serverAddr = (InetSocketAddress)(ssc.getAllLocalAddresses().iterator().next());
debug("addrs should not be empty");
}
public void start() {
}
return serverAddr;
}
public void run() {
try {
/* send a message */
/* notify client that the data has been sent */
/* wait until after the client has finished its tests */
new ShutdownNotificationHandler();
sc.configureBlocking(false);
} catch (IOException ioe) {
} catch (InterruptedException ie) {
} finally {
}
}
}
class BooleanWrapper {
boolean bool;
boolean booleanValue() {
return bool;
}
}
}
{
{
bool.booleanValue(true);
return HandlerResult.RETURN;
}
}
//--------------------- Infrastructure ---------------------------
boolean debug = true;
}