@Test
public void testResolve_httpUrl() throws Exception {

	// Run a socket server
	final int portNumber = 11200;
	final String content = "something";
	final CountDownLatch latch = new CountDownLatch( 1 );
	Runnable serverRunnable = new Runnable() {
		@Override
		public void run() {
			try {
				ServerSocket serverSocket = new ServerSocket( portNumber );
				latch.countDown();
				Socket clientSocket = serverSocket.accept();
				clientSocket.getOutputStream().write( "HTTP/1.0 200 OK\r\n\r\n".getBytes( "UTF-8" ));
				clientSocket.getOutputStream().write( content.getBytes( "UTF-8" ));
				clientSocket.getOutputStream().flush();
				clientSocket.close();
				serverSocket.close();
			} catch( IOException e ) {
				e.printStackTrace();
			}
		}
	};
	Thread t = new Thread( serverRunnable );
	t.start();
	// Wait the thread to be started
	latch.await();
	// Wait the server to be accepting requests.
	// Make several attempts as Travis builds are sometimes slow.
	DefaultUrlResolver resolver = new DefaultUrlResolver();
	ResolvedFile resolvedFile = null;
	for( int i=0; i<5; i++ ) {
		Thread.sleep( 200 );
		try {
			resolvedFile = resolver.resolve( "http://localhost:" + portNumber );
			break;
		} catch( Exception e ) {
			// nothing
		}
	}
	// Wait for the server to complete
	t.join();
	// Verify
	Assert.assertNotNull( resolvedFile );
	Assert.assertTrue( resolvedFile.getFile().exists());
	Assert.assertEquals( content, Utils.readFileContent( resolvedFile.getFile()));
	Assert.assertFalse( resolvedFile.existedBefore());
}