Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ok I found a solution and it is easy.</p> <p>What I used it <code>InetAddress.isReachable()</code> method along with some <code>HttpClient</code> by Apache. For proxy checking I used <code>blanksite.com</code> because all I need is check connectability and not speed of proxies.</p> <p>So here is the code(Including input from file, but it is not gui, YET):</p> <pre><code>/* compile with java -cp .;httpclient-4.5.1.jar;httpcore-4.4.3.jar ProxyMat run with java -cp .;httpclient-4.5.1.jar;httpcore-4.4.3.jar;commons-logging-1.2.jar ProxyMat put one proxy to check per line in the proxies.txt file in the form some.host.com:8080 */ import java.io.File; import java.io.FileNotFoundException; import java.io.RandomAccessFile; import java.net.InetAddress; import org.apache.http.params.CoreConnectionPNames; import org.apache.http.HttpEntity; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.conn.params.ConnRoutePNames; import org.apache.http.impl.client.DefaultHttpClient; public class ProxyMat{ File file=null; static RandomAccessFile read=null; public ProxyMat(){ file=new File("proxies.txt"); try { read=new RandomAccessFile(file,"rw"); } catch (FileNotFoundException e) { e.printStackTrace(); } } public void checkproxies(){ try{ String line; for(int i=0;i&lt;25;i++){ if((line=read.readLine())!=null){ System.out.println(line); String[] hp=line.split(":"); InetAddress addr=InetAddress.getByName(hp[0]); if(addr.isReachable(5000)){ System.out.println("reached"); ensocketize(hp[0],Integer.parseInt(hp[1])); } } } }catch(Exception ex){ex.printStackTrace();} } public void ensocketize(String host,int port){ try{ File pros=new File("working.txt"); HttpClient client=new DefaultHttpClient(); HttpGet get=new HttpGet("http://blanksite.com/"); HttpHost proxy=new HttpHost(host,port); client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 15000); HttpResponse response=client.execute(get); HttpEntity enti=response.getEntity(); if(response!=null){ System.out.println(response.getStatusLine()); System.out.println(response.toString()); System.out.println(host+":"+port+" @@ working"); } }catch(Exception ex){System.out.println("Proxy failed");} } public static void main(String[] args){ ProxyMat mat=new ProxyMat(); mat.checkproxies(); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload