| 53 | URL baseUrl; |
| 54 | |
| 55 | public void setUp() throws Exception { |
| 56 | RedirectingHandler handler = new RedirectingHandler(); |
| 57 | server = ServerBootstrap.bootstrap() |
| 58 | .setLocalAddress(InetAddress.getLoopbackAddress()) |
| 59 | .registerHandler("*", handler).create(); |
| 60 | server.start(); |
| 61 | handler.myAddress = server.getInetAddress(); |
| 62 | handler.port = server.getLocalPort(); |
| 63 | baseUrl = new URL("http", server.getInetAddress().getHostAddress(), server.getLocalPort(), ""); |
| 64 | System.err.println("Started server at " + baseUrl); |
| 65 | } |
| 66 | |
| 67 | public void testRedirectLoop() throws Exception { |
| 68 | URL url = new URL(baseUrl, "/loop/0"); |