18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Sahi Error - Address already in use: connect

voleynikvoleynik Members
edited November -1 in Sahi - Open Source
Hello friends:
I was wondering if you could give us your suggestion about the situation we have.

Here are the details about what we do:

Each script has 2 lines:

<<<<<<

_include("ceb-login.sah");
ceb_test("user01", "testing1", new Array("0201", "0074", "0049"));

>>>>>>

where:
user could be 01-30
array could have any number of elements with any values.

Each script includes the file "ceb-login.sah" with one function "ceb_test()":

<<<<<<<<<<<<<<<<

function ceb_test($usr, $pwd, $funding_accounts){
_wait(1000);
_setValue(_textbox("userid"), $usr);
_click(_submit("Continue"));
_setValue(_password("password"), $pwd);
_click(_submit("Sign on"));
_wait(8000);
for(var $i = 0; $i < $funding_accounts.length; $i++){
_assertContainsText($funding_accounts[$i], document.body);
}
}

>>>>>>>>>>>>>>>>>>

The scripts are organized into the suite "ceb.suite" as follows:

<<<<<<<<<<<<<<<<<<<

ceb01.sah $URL
....
ceb30.sah $URL

>>>>>>>>>>>>>>>>>>>

Finally the suite is run in batch mode using the following batch file:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

set CP=..\lib\ant-sahi.jar
set SUITE=..\scripts\ceb.suite
set IEXPLORE="C:\Program Files\Internet Explorer\IEXPLORE.EXE"
set URL=$URL

..\tools\toggle_IE_proxy.exe enable

java -cp %CP% net.sf.sahi.test.TestRunner %SUITE% %IEXPLORE% %URL% default HOST 9999 3 iexplore.exe

..\tools\toggle_IE_proxy.exe disable

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

When we start everything with 3 threads, the test runs OK.
If we start with 10 thread, we get the following errors:

``````````````` in the browser `````````````````````

Sahi Error - Address already in use: connect
Either the remote server is down or not reachable
or
You need an external proxy to be configured.

You could configure the external proxy by editing <sahi_root>/config/sahi.properties and setting these properties:

*.proxy.enable=true
*.proxy.host=external_proxy_server_hostname_or_ip
*.proxy.port=external_proxy_server_port

If your proxy needs authorization, you should set these properties too.
*.proxy.auth.enable=true
*.proxy.auth.name=proxy_authorization_username
*.proxy.auth.password=proxy_authorization_password

You should do the same with ext.* settings for h-t-t-p-s sites.

+ show stacktrace

````````````````` on the console `````````````````
java.net.BindException: Address already in use: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)


```````````````````````````````````````
Any help would be greatly appreciated.
Regards,
Vladimir.

Comments

  • voleynikvoleynik Members
    There is another piece of error message:

    java.net.SocketException: Network is unreachable: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.Socket.connect(Socket.java:519)
    at java.net.Socket.connect(Socket.java:469)
  • narayannarayan Administrators
    Vladimir,

    Could you open a command prompt, run the command "netstat" and check if there are too many open connections at the time the error occurs? You will have to do this as soon as you see the "could not connect" errors.
    Btw, are you running the web server and Sahi on the same machine?

    Could you also give some details on Sahi version, the web server, the browser used etc.? You could send a private message if you do not wish to disclose some of these details.

    Regards,
    Narayan
Sign In or Register to comment.