@Override public final boolean equals(Object socketAddr){
  if (this == socketAddr) {
    return true;
  }
  if (!(socketAddr instanceof InetSocketAddress)) {
    return false;
  }
  InetSocketAddress iSockAddr=(InetSocketAddress)socketAddr;
  if (port != iSockAddr.port) {
    return false;
  }
  if ((addr == null) && (iSockAddr.addr == null)) {
    return hostname.equals(iSockAddr.hostname);
  }
  if (addr == null) {
    return false;
  }
  return addr.equals(iSockAddr.addr);
}

@ Override public final boolean equals ( Object socketAddr ) { if ( this == socketAddr ) { return true ; } if ( ! ( socketAddr instanceof InetSocketAddress ) ) { return false ; } InetSocketAddress iSockAddr = ( InetSocketAddress ) socketAddr ; if ( port != iSockAddr . port ) { return false ; } if ( ( addr == null ) && ( iSockAddr . addr == null ) ) { return hostname . equals ( iSockAddr . hostname ) ; } if ( addr == null ) { return false ; } return addr . equals ( iSockAddr . addr ) ; }
compares two socket endpoints and returns true if they are equal . two socket endpoints are equal if the ip address or the hostname of both are equal and they are bound to the same port .
