18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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 proxy socket exception
SAHI proxy has been working fine till last week but today i faced an error, when i invoke sahi.bat the dashboard appears and i can see ">>>> Sahi started. Listening on port: 9999" how ever it doesn't work properly when i start another bat file for testing i get the following error
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
urce)
at java.net.URL.openStream(Unknown Source)
at net.sf.sahi.test.TestRunner.execute(TestRunner.java:328)
at net.sf.sahi.test.TestRunner.execute(TestRunner.java:310)
at net.sf.sahi.test.TestRunner.main(TestRunner.java:113)
I use to get this previously but if i restart sahi.bat it use to work fine but not now.please help
Answers
what Sahi version are you using and what are the involved .bat files?
Does the exception occur on launching the .bat or later, like when you run a testfile or start a suite?
Regards
Wormi
The sahi version is : 2011-07-19
on launching sahi.bat it is fine and no exception occurs in sahi console.I have another bat file to invoke the browser and call scripts during that time i get the exception (not in sahi console) in the new bat file which i opened.
Thanks
Manoj
Sahi.bat console
SAHI_HOME: ..
SAHI_USERDATA_DIR: ..\userdata
SAHI_EXT_CLASS_PATH: ..\extlib\db\mysql-connector-java-5.0.4-bin.jar;
'#java' is not recognized as an internal or external command,
operable program or batch file.
Sahi properties file = C:\Sahi_tool\sahi\config\sahi.properties
Sahi user properties file = C:\Sahi_tool\sahi\userdata\config\userdata.propertie
s
>>>> Sahi started. Listening on port: 9999
>>>> Configure your browser to use this server and port as its proxy
>>>> Browse any page and CTRL-ALT-DblClick on the page to bring up the Sahi Cont
roller
Reading browser types from: C:\Sahi_tool\sahi\userdata\config\browser_types.xml
Firefox 4 was not found at C:\Program Files\Mozilla Firefox 4.0 Beta 7\firefox.e
xe
Safari was not found at C:\Program Files\Safari\Safari.exe
Chrome was not found at $LOCALAPPDATA\Google\Chrome\Application\chrome.exe
Opera was not found at C:\Program Files\Opera\opera.exe
abc.bat console
C:\Sahi_tool\sahi\bin>set BROWSER=iexplore
C:\Sahi_tool\sahi\bin>set BROWSER_PATH="C:\Program Files\Internet Explorer\IEXPL
ORE.EXE"
C:\Sahi_tool\sahi\bin>set URL=https://localhost:6666/
C:\Sahi_tool\sahi\bin>..\tools\backup_proxy_config.exe
The system cannot find the path specified.
C:\Sahi_tool\sahi\bin>java -cp ..\lib\ant-sahi.jar net.sf.sahi.test.TestRunner C
:/Sahi_tool/sahi/userdata/scripts/COMMON/WebEMT_Cmd_Ne.suite "C:\Program Files\I
nternet Explorer\IEXPLORE.EXE" https://localhost:6666/ default localhost 9999
1 iexplore.exe
suiteName = C:/Sahi_tool/sahi/userdata/scripts/COMMON/Cmd.suite
base = https://localhost:6666/
sahiHost = localhost
port = 9999
threads = 1
browser = C:\Program Files\Internet Explorer\IEXPLORE.EXE
browserOption =
browserProcessName = iexplore.exe
this.isSingleSession == false
Added shutdown hook.
http://localhost:9999/_s_/dyn/Suite_start?suite=C:/Sahi_tool/sahi/userda
ta%2Fscripts%2FCOMMON%2FCmd.suite&base=https%3A%2F%2Flocalhost%3A6666%
2F&threads=1&sahisid=sahi_fecebe110074c04bbf09d830367aa7844df4&browser=C%3A%5CPr
ogram+Files%5CInternet+Explorer%5CIEXPLORE.EXE&browserProcessName=iexplore.exe&b
rowserOption=&html=
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
urce)
at java.net.URL.openStream(Unknown Source)
at net.sf.sahi.test.TestRunner.execute(TestRunner.java:328)
at net.sf.sahi.test.TestRunner.execute(TestRunner.java:310)
at net.sf.sahi.test.TestRunner.main(TestRunner.java:113)
New Usage 1: java -cp /path/to/ant-sahi.jar net.sf.sahi.test.TestRunner -test <t
est_or_suite_name> -browserType <browser_type> -baseURL <start_url> -threads <nu
mber_of_threads>
--- More options ---
-test path to test or suite
-baseURL baseURL for all tests
-threads no. of browser instances to run in parallel
-browserType browserType as specified in sahi/userdata/config/browser
_types.xml
-browser full browser to browser. Ignored if browserType specifie
d.
-browserProcessName browser process name used to find the pid when using ps
or tasklist commands. Ignored if browserType specified.
-browserOption Options to be passed to browser. Ignored if browserType
specified.
-junitLog true or false. Enable or disable junit logs
-junitLogDir path to junit log dir. If not specified, uses default lo
cation in userdata/logs
-htmlLog true or false. Enable or disable html logs
-htmlLogDir path to html log dir. If not specified, uses default loc
ation in userdata/logs
-initJS Any javascript which would be executed before every scri
pt
-useSingSession true or false. Execute all scripts sequentially
in a single browser session. Default is false.
-extraInfo Any extra info that may be accessed using _extraInfo()
--- OR ---
Usage: java -cp /path/to/ant-sahi.jar net.sf.sahi.test.TestRunner <test_or_suite
_name> <browser_executable> <start_url> <log_dir> <sahi_host> <sahi_port> <numbe
r_of_threads> <browser_executable> [<browser_option>]
Set log_dir to "default" to log to the default log dir
Set number_of_threads to a number which is compatible with your machine CPU and
RAM.
Look at http://sahi.co.in/w/Running+multiple+tests+in+batch+mode for details on
browser options for various browsers.
Shutting down ...
Unexpected end of file from server
C:\Sahi_tool\sahi\bin>..\tools\proxy_config.exe
The system cannot find the path specified.
C:\Sahi_tool\sahi\bin>tools\proxy_config.exe
The system cannot find the path specified.
The same .bat files work fine at times and suddenly throws this exception.
Thanks
Manoj
anyway, I see some problems here
- why is your base localhost:6666 when sahi is running on 9999
- why is there a "'#java' is not recognized as an internal or external command,
operable program or batch file." error
- is it right that IE needs no browser options?
- why do you get "The system cannot find the path specified", does your TOOLS directory exists and does it contain all needed .exes?
Sorry for that.. the contents i have posted below,
1.Sahi.bat
@echo off
if exist %SAHI_HOME% goto checkuserdata
set SAHI_HOME=..
:checkuserdata
if exist %SAHI_USERDATA_DIR% goto setuserdatadir
set SAHI_USERDATA_DIR_TMP=%SAHI_HOME%\userdata
goto startsahi
:setuserdatadir
set SAHI_USERDATA_DIR_TMP=%SAHI_USERDATA_DIR%
:startsahi
set SAHI_CLASS_PATH=%SAHI_HOME%\lib\sahi.jar;%SAHI_HOME%\extlib\rhino\js.jar;%SAHI_HOME%\extlib\apc\commons-codec-1.3.jar;
set SAHI_EXT_CLASS_PATH=%SAHI_HOME%\extlib\db\mysql-connector-java-5.0.4-bin.jar;
echo
echo SAHI_HOME: %SAHI_HOME%
echo SAHI_USERDATA_DIR: %SAHI_USERDATA_DIR_TMP%
echo SAHI_EXT_CLASS_PATH: %SAHI_EXT_CLASS_PATH%
echo
#java -Xms5m -Xmx2048m -classpath %SAHI_EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.Proxy "%SAHI_HOME%" "%SAHI_USERDATA_DIR_TMP%"
java -Xms5m -Xmx1024m -classpath %SAHI_EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.ui.Dashboard "%SAHI_HOME%" "%SAHI_USERDATA_DIR_TMP%"
2.abc.bat
:setuserdatadir
set BROWSER=iexplore
set BROWSER_PATH="C:\Program Files\Internet Explorer\IEXPLORE.EXE"
set URL=https://localhost:6666/
..\tools\backup_proxy_config.exe
java -cp ..\lib\ant-sahi.jar net.sf.sahi.test.TestRunner %SystemDrive%/Sahi_tool/sahi/userdata/scripts/COMMON/Cmd.suite %BROWSER_PATH% %URL% default localhost 9999 1 %BROWSER%.exe
..\tools\proxy_config.exe
-localhost:6666 is the url i need to access
-all other things are fine, in this same scenario proxy use to work before.
Thanks
Manoj