package dje.act.res; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; public class Instance { public static void main(String[] args){ ActiveResourceManager manag=new ActiveResourceManager(); manag.start(); try { Socket sock=new Socket("127.0.0.1", 47116); BR b=new BR(sock); b.start(); PrintWriter sockPw=new PrintWriter(sock.getOutputStream()); sockPw.write("Acquire 12312312\n"); //sockPw.close(); //sock.close(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch(Exception e){ e.printStackTrace(); } System.out.println("Started!"); System.exit(0); } } class BR extends Thread{ Socket sock; BufferedReader sockBr; public BR(Socket sock){ this.sock=sock; } public void run(){ try{ sockBr=new BufferedReader(new InputStreamReader(sock.getInputStream())); System.out.println("BReader: "+sockBr.readLine()); } catch(Exception e){ e.printStackTrace(); } } }