Code example for DatagramSocket

Methods: close, getSendBufferSize, setSendBufferSize

0
        } 
    } 
 
    public void test_getSendBufferSize() throws Exception { 
        int portNumber = Support_PortManager.getNextPortForUDP();
        ds = new java.net.DatagramSocket(portNumber);
        ds.setSendBufferSize(134);
        assertTrue("Incorrect buffer size", ds.getSendBufferSize() >= 134);
        ds.close();
        try { 
            ds.getSendBufferSize();
            fail("SocketException was not thrown.");
        } catch(SocketException se) {
            //expected 
        } 
    } 
 
    public void test_getSoTimeout() throws Exception { 
        // Test for method int java.net.DatagramSocket.getSoTimeout() 
        int portNumber = Support_PortManager.getNextPortForUDP();
        ds = new java.net.DatagramSocket(portNumber);