import java.io.*; import java.net.*; import java.util.LinkedList; public class ProxyTester { public static void main(String[] args) throws IOException { try { outputList(tryProxies(getList(args[0])), args[1]); } catch(IOException e) { System.out.print("IOException: "+e.toString()); } } private static LinkedList getList(String arg) throws IOException { LinkedList list = new LinkedList(); BufferedReader stdIn = new BufferedReader(new FileReader(arg)); String inputProxies; while ((inputProxies = stdIn.readLine()) != null) { list.add(inputProxies); } stdIn.close(); return list; } private static LinkedList tryProxies(LinkedList inputProxies) throws IOException { LinkedList workingProxies = new LinkedList(); for(String currentProxy : inputProxies) { String tmp[] = currentProxy.split(":"); if(connect(tmp[0], Integer.parseInt(tmp[1]))) { workingProxies.add(currentProxy); } } return workingProxies; } private static void outputList(LinkedList workingProxies, String arg) throws IOException { BufferedWriter out = new BufferedWriter(new FileWriter(arg)); for(String currentProxy : workingProxies) { out.write(currentProxy+"\n"); } out.close(); } private static boolean connect(String proxy, int port) throws IOException { return true; } }