List of usage examples for org.apache.commons.validator.routines InetAddressValidator getInstance
public static InetAddressValidator getInstance()
From source file:pl.kotcrab.arget.server.ArgetClient.java
private void initSocket(String serverIp, int port) throws IOException { if (InetAddressValidator.getInstance().isValidInet4Address(serverIp) == false) { InetAddress address = InetAddress.getByName(serverIp); serverIp = address.getHostAddress(); }//from w w w. j a va 2 s . c om client = new Client(200000, 200000); KryoUtils.registerNetClasses(client.getKryo()); client.start(); sender = new ExchangeSender("Client Sender", client); pinger = new ExchangePinger(sender, "Client Pinger", new TimeoutListener() { @Override public void timedOut() { postStatus(ConnectionStatus.TIMEDOUT, "Server not responded to ping messages."); disconnect(false); } }); client.connect(5000, serverIp, port); client.addListener(new Listener() { @Override public void received(Connection connection, Object object) { if (object instanceof Exchange) { Exchange exchange = (Exchange) object; processLater(exchange); } } }); }