• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HttpUnit-Net Connection Error

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
Am executin testcases in HttpUnit

I included a code to include a new JSP;

WebRequest legalRequest = new GetMethodWebRequest("http://ib9406:9080/fresh.jsp");
System.out.println("Obtained request "+ legalRequest);
HttpUnitOptions.setExceptionsThrownOnScriptError( false );
WebResponse legalResponse= conversation.getResponse(legalRequest);

I get this Exception stack trace

I thought it could be a problem with the net connection....

So I included the code segment
conversation.setProxyServer("10.237.3.28",6050);

But then I cant access my actual URL(internal).....

java.io.IOException
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:593)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272)
at com.meterware.httpunit.HttpWebResponse.readResponseHeader(HttpWebResponse.java:162)
at com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:200)
at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:56)
at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:67)
at com.meterware.httpunit.WebConversation.newResponse(WebConversation.java:76)
at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:164)
at com.meterware.httpunit.ParsedHTML.getIncludedScript(ParsedHTML.java:357)
at com.meterware.httpunit.HTMLPage$1.getIncludedScript(HTMLPage.java:257)
at com.meterware.httpunit.parsing.NekoDOMParser.getIncludedScript(NekoDOMParser.java:105)
at com.meterware.httpunit.parsing.ScriptFilter.startElement(ScriptFilter.java:92)
at org.cyberneko.html.filters.DefaultFilter.startElement(Unknown Source)
at org.cyberneko.html.filters.NamespaceBinder.startElement(Unknown Source)
at org.cyberneko.html.HTMLTagBalancer.callStartElement(Unknown Source)
at org.cyberneko.html.HTMLTagBalancer.startElement(Unknown Source)
at org.cyberneko.html.HTMLScanner$ContentScanner.scanStartElement(Unknown Source)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(Unknown Source)
at org.cyberneko.html.HTMLScanner.scanDocument(Unknown Source)
at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:41)
at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:255)
at com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1126)
at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:688)
at com.meterware.httpunit.javascript.JavaScript.load(JavaScript.java:89)
at com.meterware.httpunit.javascript.JavaScriptEngineFactory.load(JavaScriptEngineFactory.java:58)
at com.meterware.httpunit.RequestContext.runScripts(RequestContext.java:44)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:122)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113)
at TestAutoLink.populateAgentPage(TestAutoLink.java:121)
at TestAutoLink.testInitialLogin(TestAutoLink.java:99)
at TestAutoLink.testCase(TestAutoLink.java:75)
at TestAutoLink.populateData(TestAutoLink.java:60)
at TestAutoLink.testData(TestAutoLink.java:32)
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:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at junit.textui.TestRunner.run(TestRunner.java:72)
at TestAutoLink.main(TestAutoLink.java:160)
Caused by: java.net.UnknownHostException: Javascript
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:512)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:489)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:617)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderFieldKey(HttpURLConnection.java:1490)
at com.meterware.httpunit.HttpWebResponse.loadHeaders(HttpWebResponse.java:216)
at com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:198)
... 49 more
In populating Agent Page java.lang.RuntimeException: java.io.IOException

Time: 31.172

OK (1 test)
 
reply
    Bookmark Topic Watch Topic
  • New Topic