### Question:
Fetcher { public File get() throws IOException { startTime = System.currentTimeMillis(); ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port)); Channel channel = future.awaitUninterruptibly().getChannel(); if (!future.isSuccess()) { future.getChannel().close(); throw new IOException(future.getCause()); } String query = uri.getPath() + (uri.getRawQuery() != null ? "?" + uri.getRawQuery() : ""); HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, query); request.setHeader(HttpHeaders.Names.HOST, host); LOG.info("Fetch: " + uri); request.setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE); request.setHeader(HttpHeaders.Names.ACCEPT_ENCODING, HttpHeaders.Values.GZIP); ChannelFuture channelFuture = channel.write(request); channel.getCloseFuture().awaitUninterruptibly(); channelFuture.addListener(ChannelFutureListener.CLOSE); future.getChannel().close(); finishTime = System.currentTimeMillis(); return file; } Fetcher(URI uri, File file, ClientSocketChannelFactory factory); long getStartTime(); long getFinishTime(); long getFileLen(); int getMessageReceiveCount(); String getStatus(); File get(); URI getURI();  }### Answer:
@Test public void testGet() throws IOException { Random rnd = new Random(); FileWriter writer = new FileWriter(INPUT_DIR + "data"); String data; for (int i = 0; i < 100; i++) { data = ""+rnd.nextInt(); writer.write(data); } writer.flush(); writer.close(); DataRetriever ret = new DirectoryRetriever(INPUT_DIR); HttpDataServer server = new HttpDataServer( NetUtils.createSocketAddr("127.0.0.1:0"), ret); server.start(); InetSocketAddress addr = server.getBindAddress(); URI uri = URI.create("http: ClientSocketChannelFactory channelFactory = RpcChannelFactory.createClientChannelFactory("Fetcher", 1); Fetcher fetcher = new Fetcher(uri, new File(OUTPUT_DIR + "data"), channelFactory); fetcher.get(); server.stop(); FileSystem fs = FileSystem.getLocal(new TajoConf()); FileStatus inStatus = fs.getFileStatus(new Path(INPUT_DIR, "data")); FileStatus outStatus = fs.getFileStatus(new Path(OUTPUT_DIR, "data")); assertEquals(inStatus.getLen(), outStatus.getLen()); }