Mercurial > hg > Database > Alice
comparison src/alice/test/codesegment/TestRemoteAlice.java @ 15:45e98e74db96
add build.xml
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Jan 2012 01:19:54 +0900 |
parents | e3f1b21718b0 |
children | 433e601a8e28 |
comparison
equal
deleted
inserted
replaced
14:e3f1b21718b0 | 15:45e98e74db96 |
---|---|
13 | 13 |
14 public class TestRemoteAlice { | 14 public class TestRemoteAlice { |
15 | 15 |
16 public static void main(String[] args) { | 16 public static void main(String[] args) { |
17 Config conf = new Config(args); | 17 Config conf = new Config(args); |
18 AliceDaemon daemon = new AliceDaemon(conf); | 18 System.out.println(conf.port); |
19 daemon.listen(); | 19 System.out.println(conf.hostname); |
20 System.out.println(conf.connectPort); | |
21 System.out.println(conf.key); | |
22 | |
23 final AliceDaemon daemon = new AliceDaemon(conf); | |
24 new Thread() { | |
25 | |
26 @Override | |
27 public void run() { | |
28 // TODO Auto-generated method stub | |
29 daemon.listen(); | |
30 } | |
31 | |
32 }.start(); | |
33 | |
20 boolean connect = true; | 34 boolean connect = true; |
21 do { | 35 do { |
22 try { | 36 try { |
23 SocketChannel sc = SocketChannel.open(new InetSocketAddress(conf.hostname, conf.connectPort)); | 37 SocketChannel sc = SocketChannel.open(new InetSocketAddress(conf.hostname, conf.connectPort)); |
24 Connection connection = new Connection(sc.socket()); | 38 Connection connection = new Connection(sc.socket()); |
26 DataSegment.regist(conf.key, manager); | 40 DataSegment.regist(conf.key, manager); |
27 connect = false; | 41 connect = false; |
28 System.out.println("connected"); | 42 System.out.println("connected"); |
29 } catch (IOException e) { | 43 } catch (IOException e) { |
30 try { | 44 try { |
45 System.out.println("wait"); | |
31 Thread.sleep(500); | 46 Thread.sleep(500); |
32 } catch (InterruptedException e1) { | 47 } catch (InterruptedException e1) { |
33 e1.printStackTrace(); | 48 e1.printStackTrace(); |
34 } | 49 } |
35 } | 50 } |