Hey I could use some help again.
I'm working with some threads and sockets for my Torrent Client over TCP.
I have a main Thread Class (PeerManager) that is creating an ArrayList of a second Thread class (PeerConnect).
PeerManager will create PeerConnect Threads untill there is 25 of them or it runs out of peers to connect too.
I have an ArrayList for all the peers and also an ArrayList for the index of peers that have running Threads and the peers that do not. These are named "connected" and "notconnected".
All the PeerConnect threads do right now is try to open a socket with thire given IP and Port number.
The threads are named by the ID of the peer and not by creation order. The peer they try to connect too is chosen randomly by the roolpeer() method from the notconnected Arraylist.
I seem to be having two problems...
The first few Thread seem to create the socket just fine. Then the rest throw java.net.ConnectException: "Connection timed out: connect" and "Connection refused: connect" errors.
As the first few always connect just fine and are chosen randomly, is there some kind of limit to the number of sockets I can open?
The second problem is with a thread flag called Blacklist in the peerconnect class.
I set it so the flag would be set true if some kind of connection error dose come up in the peerconnect threads. That peer can be temporally black listed and dealt with later.
The PeerManager is checking for this flag in a for loop so it can black list the peer.
By the output I can see the flag is being set true but the if statement that black lists the peer never seems to run. You can also see that once the error messages start to come in on the output the "loop marker" System.out message stops being printed. I checked with a System.out... by this point the main while loop of the PeerManager class is no longer running so the program no longer get too the blacklist for loop.
The black list flag is set as volatile and I have tried synchronising its setter and geter.
There is also a Pieceno variable setting up a Static ArrayList "Blocklist" in the peerconnect class. You can see this being set in the PeerManager. Its just a list of each block to be downloaded. Other than it being initialised it's not part of the logic yet.
The PeerManager Thread Class
import java.util.ArrayList; import java.util.Random; public class PeerManager extends Thread { int ID; ArrayList<PeerConnect> peerconnection = new ArrayList<PeerConnect>(); ArrayList<String> peerlist = new ArrayList<String>(); ArrayList<Integer> connected = new ArrayList<Integer>(); ArrayList<Integer> notconnected = new ArrayList<Integer>(); ArrayList<Integer> blacklist = new ArrayList<Integer>(); String infohash; //flag for a static variable boolean flipblocklist = false; ArrayList<Long> downspeed = new ArrayList<Long>(); long pieceno = 0; boolean[] donelist; FileManager fileManager; public PeerManager(ArrayList<String> array, boolean mode, ArrayList<Long> length, ArrayList<String> path, int piecelength, int nopieces, int slength, String pieces, String hash, int pid){ //Constructor just passing variables //System.out.println("Peer Management created"); peerlist = (ArrayList<String>)array.clone(); for (int i = 0; i < peerlist.size(); i++){ notconnected.add(i); } ID = pid; setPieceno(nopieces); infohash = hash; fileManager = new FileManager(mode, length, path, piecelength, nopieces, slength, pieces, pid); } @Override public void run() { //main while loop while (true){ if (connected.size() < 20 && notconnected.size() > 0){ int last; peerconnection.add(new PeerConnect()); //index of current object last = peerconnection.size() - 1; //select random peer and update lists int newpeer = roolpeer(); peerconnection.get(last).setPeerin(peerlist.get(newpeer)); connected.add(newpeer); int remove; remove = notconnected.indexOf(newpeer); notconnected.remove(remove); peerconnection.get(last).setName(Integer.toString(newpeer)); peerconnection.get(last).setNamein(Integer.toString(newpeer)); peerconnection.get(last).setInfohash(infohash); peerconnection.get(last).start(); //setting of static variable during the first peerconnect object only if (!flipblocklist){ //System.out.println(); //System.out.println("NO Of Pieces: " + getPieceno()); //System.out.println("Block List: "); for (int i = 0; i < getPieceno(); i ++){ peerconnection.get(0).setBlocklist(i); //System.out.println(peerconnection.get(0).getBlocklist(i)); } flipblocklist = true; } //--------end of peerconnection creation System.out.println("loop Run Marker-------------------------loop Run Marker"); //------blacklist bad sockets---------------------- for (int i = 0; i < peerconnection.size(); i++){ if (peerconnection.get(i).getBlacklist() == true){ // This block of code never seems to run System.out.println("------------blackllop running"); String holdname = peerconnection.get(i).getPeerin(); peerconnection.remove(i); connected.remove(Integer.valueOf(holdname)); blacklist.add(Integer.valueOf(holdname)); System.out.println("Peer: " + holdname + " was Blacklisted"); } } } } } public long getPieceno() { return pieceno; } public void setPieceno(long pieceno) { this.pieceno = pieceno; int temp = (int) this.pieceno; donelist = new boolean[temp]; for (int i = 0; i < donelist.length; i ++){ donelist[i] = false; } } public int roolpeer(){ //Picks a random peer int ID; Random rand = new Random(); int n = rand.nextInt(notconnected.size()); ID = notconnected.get(n); return ID; } }
The PeerConnect ThreadClass
import java.net.Socket; import java.util.ArrayList; import java.net.*; import java.io.*; public class PeerConnect extends Thread { String namein; String peerin; String IP; int port; String infohash; volatile boolean Blacklist = false; //-------Socket Variables ----------- private Socket clientSocket; private BufferedOutputStream out; private BufferedInputStream in; //-------------------------------- static volatile ArrayList<Integer> blocklist = new ArrayList<Integer>(); @Override public void run() { System.out.println("Thread ID: Peer " + Thread.currentThread().getName() + " -- Created"); System.out.println("Peer Info: " + getPeerin()); peersplit(); //System.out.println("IP: " + IP); //System.out.println("Port: " + port); startConnection(); //stopConnection(); } public String getNamein() { return namein; } public void setNamein(String namein) { this.namein = namein; } public String getPeerin() { return peerin; } public void setPeerin(String peerin) { this.peerin = peerin; } public synchronized static int getBlocklist(int object) { int index = blocklist.indexOf(object); int output = blocklist.get(index); return output; } public synchronized boolean getBlacklist() { return Blacklist; } public synchronized void setBlacklist(boolean blacklist) { Blacklist = blacklist; } public static void removeBlocklist(int object){ int index = blocklist.indexOf(object); blocklist.remove(index); } public static void setBlocklist(int item) { blocklist.add(item); } public String getInfohash() { return infohash; } public void setInfohash(String infohash) { this.infohash = infohash; } public void peersplit(){ String hold = peerin; int index = hold.indexOf(":"); IP = hold.substring(0, index); port = Integer.valueOf(hold.substring(index + 1)); } public void startConnection() { boolean catchflip = true; try { clientSocket = new Socket(IP, port); out = new BufferedOutputStream(clientSocket.getOutputStream()); in = new BufferedInputStream(clientSocket.getInputStream()); } catch (UnknownHostException e) { //System.out.println("Thread: " + Thread.currentThread().getName()); catchflip = false; setBlacklist(true); System.out.println("Thread: " + Thread.currentThread().getName() + " ---Blacklist Flip"); e.printStackTrace(); } catch (IOException e) { //System.out.println("Thread: " + Thread.currentThread().getName()); catchflip = false; setBlacklist(true); System.out.println("Thread: " + Thread.currentThread().getName() + " ---Blacklist Flip"); e.printStackTrace(); } if (catchflip) System.out.println("Thread: " + Thread.currentThread().getName() + " Created a Socket Successfully..."); } public void stopConnection() { try { in.close(); out.close(); clientSocket.close(); } catch (IOException e) { e.printStackTrace(); } System.out.println("Thread: " + Thread.currentThread().getName() + " Socket Closed"); } }
All of the variables being passed in are just coming from a Torrent class in Main. Other then the Peerlist itself none of them are really part of the logic yet.
Here is that clip from Main anyway...
torrentList.List.get(lastindex).peerManager = new PeerManager( torrentList.List.get(lastindex).tracker.peers.peerlist, torrentList.List.get(lastindex).getFileMode(), torrentList.List.get(lastindex).getLengthM(), torrentList.List.get(lastindex).getPath(), torrentList.List.get(lastindex).getPieceLength(), torrentList.List.get(lastindex).getNofPieces(), torrentList.List.get(lastindex).getLength(), torrentList.List.get(lastindex).getPieces(), torrentList.List.get(lastindex).tracker.getInfohash(), lastindex );
Here is the output
loop Run Marker-------------------------loop Run Marker loop Run Marker-------------------------loop Run Marker Thread ID: Peer 26 -- Created loop Run Marker-------------------------loop Run Marker Thread ID: Peer 9 -- Created Peer Info: 196.180.223.215:53525 Peer Info: 197.239.73.94:49160 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 19 -- Created Peer Info: 160.120.226.224:45377 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 15 -- Created Peer Info: 154.68.5.123:24607 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 17 -- Created Peer Info: 196.121.53.141:36156 Thread ID: Peer 25 -- Created Peer Info: 158.222.224.153:566 Thread ID: Peer 6 -- Created Peer Info: 41.83.31.181:24875 loop Run Marker-------------------------loop Run Marker loop Run Marker-------------------------loop Run Marker loop Run Marker-------------------------loop Run Marker Thread ID: Peer 2 -- Created Peer Info: 82.252.143.235:27418 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 18 -- Created Peer Info: 184.173.3.24:6969 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 13 -- Created Peer Info: 185.149.90.38:51019 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 23 -- Created Peer Info: 190.130.154.222:34532 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 12 -- Created Peer Info: 185.221.222.115:64842 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 4 -- Created Peer Info: 41.202.86.118:49031 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 14 -- Created Peer Info: 154.72.171.21:62348 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 8 -- Created Peer Info: 200.114.100.3:46040 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 10 -- Created Peer Info: 195.199.249.225:17815 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 5 -- Created Peer Info: 41.140.48.48:49689 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 7 -- Created Peer Info: 37.135.142.160:50160 loop Run Marker-------------------------loop Run Marker Thread ID: Peer 20 -- Created Peer Info: 154.66.174.122:49160 Thread ID: Peer 22 -- Created Peer Info: 188.120.129.103:50304 Thread: 13 Created a Socket Successfully... Thread: 4 Created a Socket Successfully... Thread: 17 Created a Socket Successfully... Thread: 7 ---Blacklist Flip java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) Thread: 5 ---Blacklist Flip java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) Thread: 26 ---Blacklist Flip java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) Thread: 8 ---Blacklist Flip java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) Thread: 20 ---Blacklist Flip java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) Thread: 9 ---Blacklist Flip java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) Thread: 23 ---Blacklist Flip java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) Thread: 14 ---Blacklist Flip java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method)Thread: 10 ---Blacklist Flip Thread: 18 ---Blacklist Flip at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) Thread: 15 ---Blacklist Flip Thread: 25 ---Blacklist Flip at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33)Thread: 2 ---Blacklist Flip Thread: 19 ---Blacklist Flip java.net.ConnectException: Connection timed out: connect Thread: 6 ---Blacklist Flip Thread: 12 ---Blacklist Flip at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) Thread: 22 ---Blacklist Flip java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33) java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at PeerConnect.startConnection(PeerConnect.java:98) at PeerConnect.run(PeerConnect.java:33)