/*
* 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 4527345
* @summary Unit test for DatagramChannel's multicast support
* @build BasicMulticastTests NetworkConfiguration
* @run main BasicMulticastTests
*/
public class BasicMulticastTests {
/**
* Tests that existing membership key is returned by join methods and that
* membership key methods return the expected results
*/
throws IOException
{
// check existing key is returned
throw new RuntimeException("existing key not returned");
}
// check key
throw new RuntimeException("key is not valid");
throw new RuntimeException("group is incorrect");
throw new RuntimeException("network interface is incorrect");
throw new RuntimeException("key is source specific");
// drop membership
throw new RuntimeException("key is still valid");
}
// source-specific
try {
throw new RuntimeException("existing key not returned");
}
throw new RuntimeException("key is not valid");
throw new RuntimeException("group is incorrect");
throw new RuntimeException("network interface is incorrect");
throw new RuntimeException("key's source address incorrect");
// drop membership
throw new RuntimeException("key is still valid");
}
} catch (UnsupportedOperationException x) {
}
// done
}
/**
* Tests exceptions for invalid arguments or scenarios
*/
throws IOException
{
// IllegalStateException
try {
throw new RuntimeException("IllegalStateException not thrown");
} catch (IllegalStateException x) {
} catch (UnsupportedOperationException x) {
}
try {
try {
throw new RuntimeException("IllegalStateException not thrown");
} catch (IllegalStateException x) {
}
} catch (UnsupportedOperationException x) {
}
// IllegalArgumentException
try {
throw new RuntimeException("IllegalArgumentException not thrown");
} catch (IllegalArgumentException x) {
}
try {
throw new RuntimeException("IllegalArgumentException not thrown");
} catch (IllegalArgumentException x) {
} catch (UnsupportedOperationException x) {
}
// NullPointerException
try {
throw new RuntimeException("NullPointerException not thrown");
} catch (NullPointerException x) {
}
try {
throw new RuntimeException("NullPointerException not thrown");
} catch (NullPointerException x) {
}
try {
throw new RuntimeException("NullPointerException not thrown");
} catch (NullPointerException x) {
} catch (UnsupportedOperationException x) {
}
// ClosedChannelException
try {
throw new RuntimeException("ClosedChannelException not thrown");
} catch (ClosedChannelException x) {
}
try {
throw new RuntimeException("ClosedChannelException not thrown");
} catch (ClosedChannelException x) {
} catch (UnsupportedOperationException x) {
}
}
/**
* Probe interfaces to get interfaces that support IPv4 or IPv6 multicasting
* and invoke tests.
*/
// multicast groups used for the test
// re-run the membership key tests with IPv6 if available
}
}
}