Package java.net

Examples of java.net.DatagramSocket.disconnect()


            portNumber = Support_PortManager.getNextPortForUDP();
            ds.connect(inetAddress, portNumber);
            assertTrue("Incorrect InetAddress", ds.getInetAddress().equals(
                    inetAddress));
            assertTrue("Incorrect Port", ds.getPort() == portNumber);
            ds.disconnect();
        }

        // Create a connected datagram socket to test
        // PlainDatagramSocketImpl.peek()
        InetAddress localHost = InetAddress.getLocalHost();
View Full Code Here


     */
    public void test_disconnect() throws Exception {
        DatagramSocket ds = new DatagramSocket();
        InetAddress inetAddress = InetAddress.getLocalHost();
        ds.connect(inetAddress, 0);
        ds.disconnect();
        assertNull("Incorrect InetAddress", ds.getInetAddress());
        assertEquals("Incorrect Port", -1, ds.getPort());

        if ("true".equals(System.getProperty("run.ipv6tests"))) {
            System.out
View Full Code Here

                            + Support_Configuration.IPv6GlobalAddressJcl4);
            ds = new DatagramSocket();
            inetAddress = InetAddress
                    .getByName(Support_Configuration.IPv6GlobalAddressJcl4);
            ds.connect(inetAddress, 0);
            ds.disconnect();
            assertNull("Incorrect InetAddress", ds.getInetAddress());
            assertEquals("Incorrect Port", -1, ds.getPort());
        }
    }
View Full Code Here

        theSocket.connect(new InetSocketAddress(addr, ports[2]));
        assertTrue("Socket indicated  not connected when it should be",
                theSocket.isConnected());

        // now disconnect the socket and make sure we get the right answer
        theSocket.disconnect();
        assertFalse("Socket indicated connected when it should not be",
                theSocket.isConnected());
        theSocket.close();

        // now check behavior when socket is closed when connected
View Full Code Here

        theSocket.connect(new InetSocketAddress(addr, ports[2]));
        assertTrue("Socket indicated  not connected when it should be",
                theSocket.isConnected());

        // now disconnect the socket and make sure we get the right answer
        theSocket.disconnect();
        assertFalse("Socket indicated connected when it should not be",
                theSocket.isConnected());
        theSocket.close();

        // now check behavior when socket is closed when connected
View Full Code Here

        DatagramSocket ds = new DatagramSocket();
        InetAddress inetAddress = InetAddress.getLocalHost();
        ds.connect(inetAddress, 0);
        assertEquals("Incorrect InetAddress", inetAddress, ds.getInetAddress());
        assertEquals("Incorrect Port", 0, ds.getPort());
        ds.disconnect();

        int portNumber;
        if ("true".equals(System.getProperty("run.ipv6tests"))) {
            System.out
                    .println("Running test_connectLjava_net_InetAddressI(DatagramSocketTest) with IPv6GlobalAddressJcl4: "
View Full Code Here

            portNumber = Support_PortManager.getNextPortForUDP();
            ds.connect(inetAddress, portNumber);
            assertTrue("Incorrect InetAddress", ds.getInetAddress().equals(
                    inetAddress));
            assertTrue("Incorrect Port", ds.getPort() == portNumber);
            ds.disconnect();
        }

        // Create a connected datagram socket to test
        // PlainDatagramSocketImpl.peek()
        InetAddress localHost = InetAddress.getLocalHost();
View Full Code Here

     */
    public void test_disconnect() throws Exception {
        DatagramSocket ds = new DatagramSocket();
        InetAddress inetAddress = InetAddress.getLocalHost();
        ds.connect(inetAddress, 0);
        ds.disconnect();
        assertNull("Incorrect InetAddress", ds.getInetAddress());
        assertEquals("Incorrect Port", -1, ds.getPort());

        if ("true".equals(System.getProperty("run.ipv6tests"))) {
            System.out
View Full Code Here

                            + Support_Configuration.IPv6GlobalAddressJcl4);
            ds = new DatagramSocket();
            inetAddress = InetAddress
                    .getByName(Support_Configuration.IPv6GlobalAddressJcl4);
            ds.connect(inetAddress, 0);
            ds.disconnect();
            assertNull("Incorrect InetAddress", ds.getInetAddress());
            assertEquals("Incorrect Port", -1, ds.getPort());
        }
    }
View Full Code Here

                            + Support_Configuration.IPv6GlobalAddressJcl4);
            ds = new DatagramSocket();
            inetAddress = InetAddress
                    .getByName(Support_Configuration.IPv6GlobalAddressJcl4);
            ds.connect(inetAddress, 0);
            ds.disconnect();
            assertNull("Incorrect InetAddress", ds.getInetAddress());
            assertEquals("Incorrect Port", -1, ds.getPort());
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.