Re: java.io.IOException

"James Abley" <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
It looks like the server responded with a malformed response. Can you
reliably reproduce this and maybe use a network traffic sniffer to
monitor it at a lower level in the  networking stack?

On 28/03/07, [email protected] <[email protected]> wrote:
> why I get this error:
> Test:
> import com.meterware.httpunit.*;
>
> import junit.framework.*;
>
>
> /**
>  * An example of testing servlets using httpunit and JUnit.
>  **/
> public class ExampleTest extends TestCase {
>
>
>         public static void main(String args[]) {
>         junit.textui.TestRunner.run( suite() );
>         }
>
>
>         public static Test suite() {
>
>                 return new TestSuite( ExampleTest.class );
>         }
>
>
>         public ExampleTest( String name ) {
>             super( name );
>         }
>
>
>     /**
>      * Verifies that the welcome page has exactly one form, with the single parameter, "name"
>      **/
>     public void testWelcomePage() throws Exception {
>         HttpUnitOptions.setExceptionsThrownOnErrorStatus(false);
>         HttpUnitOptions.setExceptionsThrownOnScriptError(false);
>         HttpUnitOptions.setScriptingEnabled(false);
>         HttpUnitOptions.setLoggingHttpHeaders(true);
>         HttpUnitOptions.setCheckContentLength(false);
>
>         WebConversation     conversation = new WebConversation();
>         WebRequest request = new GetMethodWebRequest( "http://www.is24.de" );
>         WebResponse response=null;
>         response = conversation.getResponse( request );
>         WebForm forms[] = response.getForms();
>         System.out.println(forms.length);
>     }
> }
> Error:
> ........
> Connecting to imps.immobilienscout24.de
> Sending:: GET http://imps.immobilienscout24.de/?adiframe|2.0|247|65095|1|12|;KEY=home;target=_blank;
> Sending:: User-Agent: httpunit/1.5
> Sending:: Accept-Encoding: gzip
>
> Received from http://imps.immobilienscout24.de/?adiframe|2.0|247|65095|1|12|;KEY=home;target=_blank;
> Header:: null
> E
> Time: 4,195
> There was 1 error:
> 1) testWelcomePage(ExampleTest)java.io.IOException
>         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:602)
>         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.WebWindow.getSubframeResponse(WebWindow.java:128)
>         at com.meterware.httpunit.FrameHolder.updateFrames(FrameHolder.java:184)
>         at com.meterware.httpunit.WebWindow.updateFrameContents(WebWindow.java:252)
>         at com.meterware.httpunit.WebClient.updateFrameContents(WebClient.java:485)
>         at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:146)
>         at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:130)
>         at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:121)
>         at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:144)
>         at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:130)
>         at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:121)
>         at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113)
>         at ExampleTest.testWelcomePage(ExampleTest.java:42)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at ExampleTest.main(ExampleTest.java:14)
> Caused by: java.net.SocketException: Unexpected end of file from server
>         at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:822)
>         at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:711)
>         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:635)
>         at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:1530)
>         at com.meterware.httpunit.HttpWebResponse.loadHeaders(HttpWebResponse.java:213)
>         at com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:198)
>         ... 32 more
>
> FAILURES!!!
> Tests run: 1,  Failures: 0,  Errors: 1
>
>
>
>
>
> Cheers
> H.Braun
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Httpunit-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.