code: public boolean looksLike(Peer other) {
      if (other == null) {
        return false;
      }
  
      return this.hostId.equals(other.hostId) && this.getPort() == other.getPort();
    }
docs: Tells if two peers seem to look alike (i.e. they have the same IP, port
  and peer ID if they have one).