Code example for DatagramSocket

Methods: getReceiveBufferSize, setReceiveBufferSize

0
        assertEquals("getPort returned wrong value", portNumber, theSocket
                .getPort());
    } 
 
    public void test_getReceiveBufferSize() throws Exception { 
        DatagramSocket ds = new DatagramSocket();
        ds.setReceiveBufferSize(130);
        assertTrue("Incorrect buffer size", ds.getReceiveBufferSize() >= 130);
    } 
 
    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);
    } 
 
    public void test_getSoTimeout() throws Exception { 
        DatagramSocket ds = new DatagramSocket();
        ds.setSoTimeout(100);
        assertEquals("Returned incorrect timeout", 100, ds.getSoTimeout());