"SocketException: unbound sockets not implemented" with a self-signed SSL certificate

(I asked the same question about the jmeter-user mailing list, but I also wanted to try - so at least I can update this with the answer as soon as I find it).

I'm having trouble using JMeter to test a Tomcat web application using a self-signed SSL certificate. JMeter throws a SocketException with the message Unconnected sockets not implemented . In accordance with JMeter documents, the application is designed and written to accept any certificate, self-signed or signed by CA or any other.

Has anyone come across this particular exception before?

I tried to export this certificate from the server and import it into my local keystore (using keytool -import -alias tomcat -file), but the result is the same.

I also tried setting javax.net.debug = all as a JVM arg ( the JSSE reference manual shows this as a debugging step); however, I don't see a way out for debugging anywhere - should I expect this somewhere other than the standard output / error?

+6
java ssl
source share
6 answers

Most javax.net.SocketFactory implementations define all createSocket() methods that have parameters as abstract. But have a createSocket() method with no parameters, which looks like this:

 public Socket createSocket() throws IOException { throw new SocketException("Unconnected sockets not implemented"); } 

So, you subclass abstract javax.net.SocketFactory , you will be forced to override methods with a parameter, but it is easy to skip overriding the createSocket() method without parameters. Thus, an exception is thrown if your code calls createSocket() . Just override the method and do it. :)

+5
source share

This is more a hint than a correct answer. A quick look at Googleโ€™s results seems to suggest that this exception is usually caused by code that forces the use of a standard SSL factory socket, which specifically throws an exception when createSocket (). Some of the results seem to indicate that the problem sometimes occurs due to an error in a specific version of Java 6 or when the wrong path or password is provided in the keystore.

So, I would say try using Java 5. Also try pointing JMeter to a well-known site that uses the correct SSL certificates. This way you can test the hypothesis with a self-signed certificate.

+2
source share

I had the same problem in my code (not related to JMeter).

My code uses a self- SocketFactory . I found out that the class com.sun.jndi.ldap.Connection calls some SocketFactory methods using Method.invoke() . One of the methods that he is trying to call is createSocket() - without parameters.

When I added such a method to my factory, everything worked fine.

+2
source share

I had problems with a web service like this with jdk 1.6.0_10.

I updated to 1.6.0_16 and it worked.

0
source share

Try to find your classpath (in Eclipse, I do ctrl-shift-t for this) for SSLSocketFactory *. If you find it, set it as a property in the security class:

In my environment, I found the following two:

 Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl"); 

or

 Security.setProperty("ssl.SocketFactory.provider", "com.ibm.websphere.ssl.protocol.SSLSocketFactory"); 

(or for any other class you find)

Similarly for ServerSocketFactory , if you need server sockets.

0
source share

Here is my solution (java 1.6) completely removes TLS_DHE_ ciphers, forcibly overrides the createSocket () methods

( https://gist.github.com/hoangthienan/735afb17ffd6955de95a49aa0138dbaa )

0
source share

All Articles