class PeerAddress implements Comparable {

    private void fromString(String addr) {
        if (addr == null || addr.isEmpty()) {
            addr = "localhost";
        }
        try {
            String a = addr.toLowerCase();
            if (!a.startsWith("http")) {
                a = "http://" + a;
            }
            URL u = new URL(a);
            hostName = u.getHost();
            setHost(hostName);
            port = u.getPort();
            if (port == -1) {
                port = Constants.DEFAULT_PEER_PORT;
            }
        } catch (MalformedURLException ex) {
            valid = false;
        }
    }

    public  PeerAddress(int port, String host);
    public  PeerAddress();
    public  PeerAddress(String hostWithPort);

}