package org.apache.commons.vfs2.provider.https.test;

import org.apache.commons.vfs2.FileContent;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
import org.junit.Assert;
import org.junit.Test;

/**
 * Tests VFS-427 NPE on HttpFileObject.getContent().getContentInfo()
 *
 * @since 2.1
 */
public class GetContentInfoFunctionalTest
{

    /**
     * Tests VFS-427 NPE on HttpFileObject.getContent().getContentInfo().
     *
     * @throws FileSystemException
     *             thrown when the getContentInfo API fails.
     */
    @Test
    public void testGoogle() throws FileSystemException
    {
        final FileSystemManager fsManager = VFS.getManager();
        final FileObject fo = fsManager.resolveFile("https://www.google.com/images/logos/ps_logo2.png");
        final FileContent content = fo.getContent();
        Assert.assertNotNull(content);
        // Used to NPE before fix:
        content.getContentInfo();
    }
}

@@ -47,16 +47,77 @@
 .test;%0A%0A
+import java.net.MalformedURLException;%0Aimport java.net.URL;%0A%0A
 import o
@@ -332,12 +332,137 @@
 fs2.
-VFS;
+FileSystemOptions;%0Aimport org.apache.commons.vfs2.VFS;%0Aimport org.apache.commons.vfs2.provider.http.HttpFileSystemConfigBuilder;%0A
 %0Aimp
@@ -841,81 +841,984 @@
    *
-/%0A    @Test%0A    public void testGoogle() throws FileSystemException%0A    %7B
+ @throws MalformedURLException %0A     *             thrown when the System environment contains an invalid URL for an HTTPS proxy.%0A     */%0A    @Test%0A    public void testGoogle() throws FileSystemException, MalformedURLException%0A    %7B%0A    %09String httpsProxyHost = null;%0A    %09int httpsProxyPort = -1;%0A        final String httpsProxy = System.getenv(%22https_proxy%22);%0A        if (httpsProxy != null) %7B%0A        %09final URL url = new URL(httpsProxy);%0A        %09httpsProxyHost = url.getHost();%0A        %09httpsProxyPort = url.getPort();%0A        %7D%0A        final FileSystemOptions opts;%0A        if (httpsProxyHost != null) %7B%0A            opts = new FileSystemOptions();%0A            final HttpFileSystemConfigBuilder builder = HttpFileSystemConfigBuilder.getInstance();%0A            builder.setProxyHost(opts, httpsProxyHost);%0A            if (httpsProxyPort %3E= 0) %7B%0A            %09builder.setProxyPort(opts, httpsProxyPort);%0A            %7D%0A        %7D else %7B%0A        %09opts = null;%0A        %7D%0A        
 %0A   
@@ -1978,16 +1978,22 @@
 go2.png%22
+, opts
 );%0A     

Support https_proxy environment variable to pass test.