### Question:
AvailablePortFinder { public static boolean available( int port ) { if ( port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER ) { throw new IllegalArgumentException( "Invalid start port: " + port ); } ServerSocket ss = null; DatagramSocket ds = null; try { ss = new ServerSocket( port ); ss.setReuseAddress( true ); ds = new DatagramSocket( port ); ds.setReuseAddress( true ); return true; } catch ( IOException e ) { } finally { if ( ds != null ) { ds.close(); } if ( ss != null ) { try { ss.close(); } catch ( IOException e ) { } } } return false; } private  AvailablePortFinder(); static Set<Integer> getAvailablePorts(); static int getNextAvailable(); static int getNextAvailable( int fromPort ); static boolean available( int port ); static Set<Integer> getAvailablePorts( int fromPort, int toPort ); static final int MIN_PORT_NUMBER; static final int MAX_PORT_NUMBER; }### Answer:
@Test public void testAvailable() { int port = 2000; boolean result = AvailablePortFinder.available( port ); assertTrue( result ); }