1892N/A/*
1892N/A * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
1892N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1892N/A *
1892N/A * This code is free software; you can redistribute it and/or modify it
1892N/A * under the terms of the GNU General Public License version 2 only, as
1892N/A * published by the Free Software Foundation.
1892N/A *
1892N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1892N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1892N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1892N/A * version 2 for more details (a copy is included in the LICENSE file that
1892N/A * accompanied this code).
1892N/A *
1892N/A * You should have received a copy of the GNU General Public License version
1892N/A * 2 along with this work; if not, write to the Free Software Foundation,
1892N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1892N/A *
1892N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1892N/A * or visit www.oracle.com if you need additional information or have any
1892N/A * questions.
1892N/A */
1892N/A
1892N/A/*
1892N/A * @test
1892N/A *
1892N/A * @bug 6425815
1892N/A *
1892N/A * @summary java.net.MulticastSocket.setTimeToLive(255) reports 'Socket closed' (WinXP, IPv6)
1892N/A *
1892N/A */
1892N/Aimport java.net.*;
1892N/Aimport java.io.IOException;
1892N/A
1892N/Apublic class B6425815 {
1892N/A public static void main(String[] args) throws Exception {
1892N/A InetAddress ia;
1892N/A MulticastSocket ms;
1892N/A
1892N/A try {
1892N/A ia = InetAddress.getByName("::1");
1892N/A ms = new MulticastSocket(new InetSocketAddress(ia, 1234));
1892N/A } catch (Exception e) {
1892N/A // If this fails, it means the system doesn't have IPV6
1892N/A // support, therefore this test shouldn't be run.
1892N/A ia = null;
1892N/A ms = null;
1892N/A }
1892N/A if (ms != null) {
1892N/A ms.setTimeToLive(254);
1892N/A if (ms.getTimeToLive() != 254) {
1892N/A throw new RuntimeException("time to live is incorrect!");
1892N/A }
1892N/A ms.close();
1892N/A }
1892N/A }
1892N/A}
1892N/A