I was able to get around my issue with the protocol returned from
"getHostConfig()" being null.  I'm now getting the URI from the method,
and using the fields from that.  That works fine.

At this point, I believe I've followed all the instructions in the SSL
Guide for setting up an alternate socket factory (the "easy" one, for
self-signed certs).  However, I still get the "Could not find trusted
certificate" exception.  I tried setting breakpoints in the methods of
the "EasySSLProtocolSocketFactory" class, and I find that only the
constructor is ever called (because I called it when I instantiated it),
the "createSocket()" methods are never called.  I guess that makes it
somewhat understandable that I'm still getting the certificate
exception.  It obviously means my new socket factory is being ignored.

My code looks somewhat like this:
--------------------
                method  = new PostMethod(getGatewayURL());
                URI  uri   = method.getURI();
                if (uri.getScheme().equals("https"))
                {
                    Class  socketFactoryClass   =
                        Class.forName(getSSLSocketFactory());
                    SecureProtocolSocketFactory factory  =
                        (SecureProtocolSocketFactory)
                        socketFactoryClass.newInstance();
                    Protocol  newProtocol =
                        new Protocol(uri.getScheme(), factory,
uri.getPort());
                    hostConfig.setHost(uri.getHost(), uri.getPort(),
                                       newProtocol);
                    method  = new PostMethod(getGatewayURL());
                }
                httpClient.executeMethod(method);
--------------------

(If I can get this to work, I'll probably not have the double creation
of the "method" object, I'll just create a URI from the URL string and
eventually create the method from that.  I don't believe that will fix
my current problem, so I'm not handling that yet.)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to