http-request
http-request copied to clipboard
Proxy Test Failure
When building the maven tests, the test HttpRequestTest.basicProxyAuthentication() fails. I'm not very familiar with Jetty, but it seems the "proxyCountingHandler" defined in ServerTestCase.setUp() is never called.
Running com.github.kevinsawicki.http.HttpRequestTest
2013-05-29 11:18:59.299:INFO:oejs.Server:jetty-8.1.9.v20130131
2013-05-29 11:18:59.338:INFO:oejs.AbstractConnector:Started [email protected]:41443
2013-05-29 11:18:59.357:INFO:oejs.Server:jetty-8.1.9.v20130131
2013-05-29 11:18:59.366:INFO:oejs.AbstractConnector:Started [email protected]:58866
Tests run: 145, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.578 sec <<< FAILURE!
Results :
Failed tests: basicProxyAuthentication(com.github.kevinsawicki.http.HttpRequestTest): expected:<user> but was:<null>
Tests run: 147, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] http-request ...................................... FAILURE [3.849s]
[INFO] http-request-parent ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.657s
[INFO] Finished at: Wed May 29 11:19:00 EDT 2013
[INFO] Final Memory: 14M/90M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project http-request: There are test failures.
[ERROR]
[ERROR] Please refer to /home/rossimo/http-request/lib/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project http-request: There are test failures.
Please refer to /home/rossimo/http-request/lib/target/surefire-reports for the individual test results.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Sorry about the re-open, getting use to GitHub's ticket system.
Hi, what OS are you on and what version of Java are you using?
I've tested on two machines, reporting the same failure.
Machine 1: Linux Mint 14
java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
Machine 2: Windows 8 64-bit
java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
@henryju any ideas on this one?
Difficult to investigate without being able to reproduce.
@rossimo in the HttpRequestTest#basicProxyAuthentication() method could you please try to comment: assertEquals("user", proxyUser.get()); assertEquals("p4ssw0rd", proxyPassword.get()); in order to see if the two following assertions are passing.
Thanks
Can you also check that the system properties -Dhttp.nonProxyHost or other proxy related properties are not defined for the JVM you are using.
I've pulled the latest, and retested with commenting out the two credential lines suggested. Fails with the following result:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.github.kevinsawicki.http.EncodeTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.063 sec
Running com.github.kevinsawicki.http.HttpRequestTest
2013-06-16 17:24:38.213:INFO:oejs.Server:jetty-8.1.9.v20130131
2013-06-16 17:24:38.253:INFO:oejs.AbstractConnector:Started SelectChannelConnect
[email protected]:4951
2013-06-16 17:24:38.278:INFO:oejs.Server:jetty-8.1.9.v20130131
2013-06-16 17:24:38.286:INFO:oejs.AbstractConnector:Started SelectChannelConnect
[email protected]:4954
Tests run: 148, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.639 sec <<<
FAILURE!
Results :
Failed tests: basicProxyAuthentication(com.github.kevinsawicki.http.HttpReques
tTest): expected:<1> but was:<0>
Tests run: 150, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] http-request ...................................... FAILURE [3.127s]
[INFO] http-request-parent ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.956s
[INFO] Finished at: Sun Jun 16 17:24:39 EDT 2013
[INFO] Final Memory: 10M/119M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
10:test (default-test) on project http-request: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Ross\Code\http-request\lib\target\surefire-repo
rts for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption
I will hack in a little code to dump the JVM's system's properties soon to see if "http.nonProxyHost" is present.
OK, I've reverted my working copy, and tacked the following code into HttpRequestTest.basicProxyAuthentication():
Properties props = System.getProperties();
props.list(System.out);
Result:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.github.kevinsawicki.http.EncodeTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.082 sec
Running com.github.kevinsawicki.http.HttpRequestTest
2013-06-16 17:29:20.300:INFO:oejs.Server:jetty-8.1.9.v20130131
2013-06-16 17:29:20.346:INFO:oejs.AbstractConnector:Started SelectChannelConnect
[email protected]:5117
2013-06-16 17:29:20.373:INFO:oejs.Server:jetty-8.1.9.v20130131
2013-06-16 17:29:20.384:INFO:oejs.AbstractConnector:Started SelectChannelConnect
[email protected]:5120
-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=C:\Program Files\Java\jdk1.6.0_43\jre...
java.vm.version=20.14-b01
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg=sun.io
user.country=US
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=
java.vm.specification.name=Java Virtual Machine Specification
user.dir=C:\Users\Ross\Code\http-request\lib
java.runtime.version=1.6.0_43-b01
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
basedir=C:\Users\Ross\Code\http-request\lib
java.endorsed.dirs=C:\Program Files\Java\jdk1.6.0_43\jre...
os.arch=amd64
surefire.real.class.path=C:\Users\Ross\Code\http-request\lib\t...
java.io.tmpdir=C:\Users\Ross\AppData\Local\Temp\
line.separator=
java.vm.specification.vendor=Sun Microsystems Inc.
user.variant=
os.name=Windows 8
sun.jnu.encoding=Cp1252
java.library.path=C:\Program Files\Java\jdk1.6.0_43\jre...
surefire.test.class.path=C:\Users\Ross\Code\http-request\lib\t...
java.specification.name=Java Platform API Specification
java.class.version=50.0
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
os.version=6.2
user.home=C:\Users\Ross
user.timezone=America/New_York
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.specification.version=1.6
file.encoding=Cp1252
user.name=Ross
java.class.path=C:\Users\Ross\Code\http-request\lib\t...
java.vm.specification.version=1.0
sun.arch.data.model=64
java.home=C:\Program Files\Java\jdk1.6.0_43\jre
sun.java.command=C:\Users\Ross\Code\http-request\lib\t...
java.specification.vendor=Sun Microsystems Inc.
user.language=en
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.6.0_43
java.ext.dirs=C:\Program Files\Java\jdk1.6.0_43\jre...
sun.boot.class.path=C:\Program Files\Java\jdk1.6.0_43\jre...
java.vendor=Sun Microsystems Inc.
localRepository=C:\Users\Ross\.m2\repository
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.desktop=windows
sun.cpu.isalist=amd64
Tests run: 148, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.692 sec <<<
FAILURE!
Results :
Failed tests: basicProxyAuthentication(com.github.kevinsawicki.http.HttpReques
tTest): expected:<user> but was:<null>
Tests run: 150, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] http-request ...................................... FAILURE [5.288s]
[INFO] http-request-parent ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.115s
[INFO] Finished at: Sun Jun 16 17:29:21 EDT 2013
[INFO] Final Memory: 16M/170M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
10:test (default-test) on project http-request: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Ross\Code\http-request\lib\target\surefire-repo
rts for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption
I don't see "http.nonProxyHost" listed there. Hopefully I'm looking in the right place. I'm running "mvn test", and I haven't added arguments, and I don't think there's anything strange in my environmental variables. Is there somewhere else I can look?
Hmm, I'm really not sure why this is failing, granted I've never ran this on a Windows machine but on my Mac and on Travis CI the tests are passing consistently.
Sorry for not having more suggestions, it is unclear to me how the request could get marked as a 200
without the proxyCountingHandler
being called in ServerTestCase
.