@Override    
    /**
     * Verifica se o Tracker esta online
     */
    public void run() {        
        while (true) {
            if (!processo.knowTracker) {
                eleicao();
            }else{  
                try {                                        
                    byte[] buf = new byte[1024];
                    DatagramPacket pack = new DatagramPacket(buf, buf.length);
                    multicastSocket.setSoTimeout(5000);
                    multicastSocket.receive(pack);
                    
                    byte[] messgage = Arrays.copyOfRange(buf, 0, Funcoes.getKeyIndex() - 1);
                    byte[] key = Arrays.copyOfRange(buf, Funcoes.getKeyIndex(), buf.length);
                    
                    String resposta = new String(messgage);
                    String respostaEsperada = "Peer id:";
                    
                    //System.out.println("MULTiCAST DO PEER <- " + resposta);
//                  System.out.println( new String("\tFrom: " + pack.getAddress().getHostAddress() + ":" + pack.getPort()) );
                      
                    String data = resposta.substring(0,respostaEsperada.length());
                    if(data.equals(respostaEsperada)){ 
                        //System.out.println("MULTiCAST DO PEER <- " + resposta);
                       
                       int tempID = Integer.parseInt(resposta.substring(8,10));               
                       if(!peersHasID(tempID)){
                           PublicKey keyRecebida = KeyFactory.getInstance("RSA", "BC").generatePublic(new X509EncodedKeySpec(key));
                           Peer newPeer = new Peer(tempID, keyRecebida, pack.getAddress(),pack.getPort());
                           peers.add(newPeer);
                           String peer = "Peer id:"+processo.getId()+";porta:"+processo.getSocketUnicast().getLocalPort()+";";
                           multicastSocket.enviarMensagem(peer, processo.getPublicKey());
                           System.out.println("Novo peer: "+newPeer.getSettings());
                       }
                    }
                    
                    respostaEsperada = Funcoes.TRACKER_HELLO;
                    data = resposta.substring(0,respostaEsperada.length());
                    if(data.equals(respostaEsperada)){ //atualiza o tracker atual
                        System.out.println("MULTiCAST DO PEER <- " + resposta);
                        String str = resposta.substring(30);
                        int id = Integer.parseInt(resposta.substring(21,23));
                        PublicKey keyRecebida = KeyFactory.getInstance("RSA", "BC").generatePublic(new X509EncodedKeySpec(key));
                        int porta = Integer.parseInt(str.substring(0, str.indexOf(";")));
                        Peer peer = new Peer(id, keyRecebida, pack.getAddress(), porta);
                        processo.updateTracker(peer);
                    }
                    
                    
                } catch(SocketTimeoutException ex){
                    System.out.println("Tracker caiu!");                    
                    processo.knowTracker = false;
                    processo.isReady = false;                    
                    processo.changePanel = true;
                }catch (SocketException ex) {
                    Logger.getLogger(MultiCastPeer.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IOException | InvalidKeySpecException ex) {
                    Logger.getLogger(MultiCastPeer.class.getName()).log(Level.SEVERE, null, ex);
                } catch (NoSuchAlgorithmException | NoSuchProviderException ex) {
                    Logger.getLogger(MultiCastPeer.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }