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); PrintWriter sockPw=new PrintWriter(sock.getOutputStream()); BR b=new BR(sock); b.start(); sockPw.write("Acquire 12312312\n"); sockPw.close(); System.out.println("SockBr: "+b.readLine()); //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())); } catch(Exception e){ e.printStackTrace(); } } public String readLine(){ String s=""; try{ s=sockBr.readLine(); } catch(Exception e){ e.printStackTrace(); } return s; } }