Looks
like you get a Connection Refused.
Do you
have a server running on port 7001???
Try
using Internet Exploder... or Firefox....????
Verify
you have a listening port before running the test by using this command:
netstat -a
HTH....
Nick
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, November 12, 2004 2:53 PM
To: [EMAIL PROTECTED]
Subject: [Jwebunit-users] connection exception. How to connect to port 7001
My code reads like this.
package com.freddiemac.pe.servicing.loanpaymentprocessing.api;
import net.sourceforge.jwebunit.WebTestCase;
public class JWebUnitSearchExample extends WebTestCase {
public JWebUnitSearchExample(String name) {
super(name);
}
public void setUp() {
getTestContext().setBaseUrl("http://localhost:7001/showcase/");
}
public void testSearch() {
beginAt("/");
assertLinkPresentWithText("Sign in");
}
public static void main(String[] args) {
JWebUnitSearchExample tester = new JWebUnitSearchExample("test1");
tester.testSearch();
}
}
I get following exception.
C:\>java com.freddiemac.pe.servicing.loanpaymentprocessing.api.JWebUnitSearchExample
Exception in thread "main" java.lang.RuntimeException: 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:147)
at com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:185)
at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:53)
at com.meterware.httpunit.WebConversation.newResponse(WebConversation.java:61)
at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:162)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:125)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:118)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:112)
at net.sourceforge.jwebunit.HttpUnitDialog.<init>(HttpUnitDialog.java:48)
at net.sourceforge.jwebunit.WebTester.beginAt(WebTester.java:55)
at net.sourceforge.jwebunit.WebTestCase.beginAt(WebTestCase.java:46)
at com.freddiemac.pe.servicing.loanpaymentprocessing.api.JWebUnitSearchExample.testSearch(JW
ebUnitSearchExample.java:24)
at com.freddiemac.pe.servicing.loanpaymentprocessing.api.JWebUnitSearchExample.main(JWebUnit
SearchExample.java:30)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
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:201)
at com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:183)
... 11 more
at net.sourceforge.jwebunit.HttpUnitDialog.<init>(HttpUnitDialog.java:50)
at net.sourceforge.jwebunit.WebTester.beginAt(WebTester.java:55)
at net.sourceforge.jwebunit.WebTestCase.beginAt(WebTestCase.java:46)
at com.freddiemac.pe.servicing.loanpaymentprocessing.api.JWebUnitSearchExample.testSearch(JW
ebUnitSearchExample.java:24)
at com.freddiemac.pe.servicing.loanpaymentprocessing.api.JWebUnitSearchExample.main(JWebUnit
SearchExample.java:30)
All suggestions are welcome.
Thanks.
- Neeraj
- - - - - -
This e-mail message is intended only for the use of the individual or entity identified in the alias address of this message and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution of this e-mail message is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message from your system. Thank you.