Code example for InetSocketAddress

Methods: getHostName, getPort

0
 
		target.setAsText("localhost:80");
 
		InetSocketAddress address = (InetSocketAddress) target.getValue();
 
		assertEquals("localhost", address.getHostName());
 
		assertEquals(80, address.getPort());
 
	} 
 
	@Test 
	public void testSetAsText_PortOnly() { 
 
		target.setAsText("80");
 
		InetSocketAddress address = (InetSocketAddress) target.getValue();
 
		assertEquals("0.0.0.0", address.getHostName());
 
		assertEquals(80, address.getPort());