| 39 | static final int kMaxLength = 6 * kMB; |
| 40 | |
| 41 | public static void main(String[] args) throws Exception { |
| 42 | ChannelFactory channelFactory = new NioClientSocketChannelFactory( |
| 43 | Executors.newCachedThreadPool(), |
| 44 | Executors.newCachedThreadPool()); |
| 45 | long start = System.currentTimeMillis(); |
| 46 | |
| 47 | final CountDownLatch latch = new CountDownLatch(kClients); |
| 48 | ChannelPipelineFactory pipelineFactory = new PipelineFactory(kMinLength, kMaxLength, latch); |
| 49 | for (int i = 0; i < kClients; ++i) { |
| 50 | ClientBootstrap bootstrap = new ClientBootstrap(channelFactory); |
| 51 | bootstrap.setPipelineFactory(pipelineFactory); |
| 52 | bootstrap.connect(new InetSocketAddress(args[0], 2021)); |
| 53 | } |
| 54 | |
| 55 | latch.await(); |
| 56 | |
| 57 | System.out.println(Thread.currentThread().getId() + " All done. " |
| 58 | + (System.currentTimeMillis() - start)); |
| 59 | System.exit(0); |
| 60 | } |
| 61 | |
| 62 | } |