Java tutorial
//package com.java2s; /** * Copyright (C) 2009-2013 Barchart, Inc. <http://www.barchart.com/> * * All rights reserved. Licensed under the OSI BSD License. * * http://www.opensource.org/licenses/bsd-license.php */ import java.net.InetSocketAddress; public class Main { public static void checkSocketAddress(final InetSocketAddress socketAddress) { if (socketAddress == null) { throw new IllegalArgumentException("socketAddress can't be null"); } /** can not use in JNI ; internal InetAddress field is null */ if (socketAddress.isUnresolved()) { throw new IllegalArgumentException( "socketAddress is unresolved : " + socketAddress + " : check your DNS settings"); } } }