954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

JUnit Testing: Could not connect to: : <Socket>

Could not connect to:  : 50404			
java.net.ConnectException: Connection refused: 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.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:520)
	at java.net.Socket.connect(Socket.java:470)
	at java.net.Socket.<init>(Socket.java:367)
	at java.net.Socket.<init>(Socket.java:180)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.connect(RemoteTestRunner.java:560)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:377)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


has anyone run into this issue and or find a fix? I've not been able to get much from google. I have been running unit tests no problem them wham it poops out :P.

I've tried restarting, disconnecting the network cable, starting up a new instance of eclipse, disabling the windows firewall...etc

However if I run a "mvn test" on the project from the command line all goes well as expected >_

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

Ending up being able to solve this one. Debugged the servlet used for the connection to the JUnit window. Found it was using the wrong port (for some reason it was placing it a single digit below the correct port) and stepped through each iteration of the servlet doConnect() method adjusting the port each time.

Once I did that JUnit testing began to work as normal; hopefully however, it will continue to do so next time I start up eclipse :P

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

Hey,

I've seen this problem, too, on a corporate laptop when it wasn't connected to the corporate network (by being either plugged directly into it or tunneled in with the laptop's Nortel VPN client). Stopping the laptop's "McAfee Host Intrusion Prevention Service" would resolve the problem and enable Eclipse to run JUnit tests.

dmanchester
Newbie Poster
1 post since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You