How to manually disconnect a peer from peergroup? Here is my code.

    params = TestNet3Params.get();
    blockStore = new MemoryBlockStore(params);

    chain = new BlockChain(params, blockStore);
    chain.addWallet(newwallet);

    final PeerGroup peerGroup = new PeerGroup(params, chain);
    peerGroup.setUserAgent("PeerMonitor", "1.0");
    peerGroup.setMaxConnections(1);
    peerGroup.addAddress(new PeerAddress(InetAddresses.forString("192.168.1.253"), 18333));

    peerGroup.addEventListener(new AbstractPeerEventListener() {
        @Override
        public void onPeerDisconnected(Peer peer, int peerCount) {
            System.out.println("hello "+peer.getAddress().getAddr().getHostAddress());
            peerGroup.addPeerDiscovery(new DnsDiscovery(params)); 
            System.out.println("DNS Added...!!");

        }
    });

    peerGroup.startAsync();

    peerGroup.downloadBlockChain();
    System.out.println("Full Downloaded...!!");

    List&lt;Peer&gt; peers=peerGroup.getConnectedPeers();


    System.out.println(peers);
    for (Peer peer : peers) {
        if(peer.getAddress().getAddr().getHostName().equals("192.168.1.253"))
        {
            System.out.println("checking peers...!!");
            break;
        }
    }
    System.out.println("going to stop...!!");


I want to stop the local peer and switch to the DNS when the downloading gets completed.
Simply:

peer.close();


Peer.java extends PeerSocketHandler.java, which is the class that defines the close() method, so maybe that's why you weren't seeing it. It would also probably be easier to find if it were called disconnect().