|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jsslutils.sslcontext.test.MiniSslClientServer
public abstract class MiniSslClientServer
This class contains both a client and a server that can be used to build small tests, to test the SSLContextFactory. These examples come with a demo CA (a few certificates and keys). These are not to be used in real-life application. DO NOT add them to your set of trusted certificates in your web-browser or similar application.
Nested Class Summary | |
---|---|
protected static class |
MiniSslClientServer.RequestHandler
Small class that handles a server request. |
Field Summary | |
---|---|
static java.lang.String |
CERTIFICATES_DIRECTORY
|
static java.lang.String |
KEYSTORE_PASSWORD
|
protected java.lang.Exception |
listeningServerException
|
protected java.util.concurrent.LinkedBlockingQueue<java.util.concurrent.Future<java.lang.Object>> |
serverRequestsFutures
|
protected int |
serverTimeout
|
protected boolean |
stopServer
|
protected int |
testPort
|
protected boolean |
verboseExceptions
|
Constructor Summary | |
---|---|
MiniSslClientServer()
|
Method Summary | |
---|---|
java.security.KeyStore |
getBadClientCertKeyStore()
Returns the keystore containing a test key and certificate that is not to be trusted by the server when CRLs are enabled. |
java.security.KeyStore |
getCaKeyStore()
Returns the store of CA certificates, to be used as a trust store. |
protected java.lang.String |
getCertificatesDirectory()
|
java.security.KeyStore |
getGoodClientCertKeyStore()
Returns the keystore containing a test key and certificate that is to be trusted by the server. |
java.util.Collection<java.security.cert.X509CRL> |
getLocalCRLs()
Returns a collection of CRLs to be used by the tests. |
java.security.KeyStore |
getServerCertKeyStore()
Returns the keystore containing the key and the certificate to be used by the server. |
protected java.lang.Exception |
makeClientRequest(javax.net.ssl.SSLContext sslClientContext)
|
protected javax.net.ssl.SSLServerSocket |
prepareServerSocket(javax.net.ssl.SSLContext sslServerContext)
Creates and binds the SSLServerSocket to a port after trying a few port numbers. |
protected java.lang.Throwable |
printSslException(java.lang.String prefix,
javax.net.ssl.SSLException sslException,
javax.net.ssl.SSLSocket socket)
Used for printing out more info when there's a problem. |
protected void |
printSslSocketInfo(javax.net.ssl.SSLSocket socket)
Used for printing out more info when there's a problem. |
protected java.lang.Thread |
runServer(javax.net.ssl.SSLServerSocket serverSocket)
Starts the mini server. |
boolean |
runTest(javax.net.ssl.SSLContext sslClientContext,
javax.net.ssl.SSLContext sslServerContext)
This runs the main test: it runs a client and a server. |
protected void |
setServerRequestNumber(int serverRequestNumber)
Sets the number of requests the mini server is supposed to accept. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CERTIFICATES_DIRECTORY
public static final java.lang.String KEYSTORE_PASSWORD
protected volatile boolean stopServer
protected boolean verboseExceptions
protected volatile int serverTimeout
protected int testPort
protected final java.util.concurrent.LinkedBlockingQueue<java.util.concurrent.Future<java.lang.Object>> serverRequestsFutures
protected volatile java.lang.Exception listeningServerException
Constructor Detail |
---|
public MiniSslClientServer()
Method Detail |
---|
protected java.lang.String getCertificatesDirectory()
public java.security.KeyStore getCaKeyStore() throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.KeyStoreException, java.security.cert.CertificateException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.cert.CertificateException
public java.security.KeyStore getServerCertKeyStore() throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.KeyStoreException, java.security.cert.CertificateException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.cert.CertificateException
public java.security.KeyStore getGoodClientCertKeyStore() throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.KeyStoreException, java.security.cert.CertificateException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.cert.CertificateException
public java.security.KeyStore getBadClientCertKeyStore() throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.KeyStoreException, java.security.cert.CertificateException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.cert.CertificateException
public java.util.Collection<java.security.cert.X509CRL> getLocalCRLs() throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.KeyStoreException, java.security.cert.CertificateException, java.security.cert.CRLException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.cert.CertificateException
java.security.cert.CRLException
protected void setServerRequestNumber(int serverRequestNumber)
serverRequestNumber
- protected javax.net.ssl.SSLServerSocket prepareServerSocket(javax.net.ssl.SSLContext sslServerContext)
sslServerContext
- SSLContext from which to build the socket and its
SSLSocketFactory.
protected java.lang.Thread runServer(javax.net.ssl.SSLServerSocket serverSocket)
serverSocket
- bound SSLServerSocket for this server.public boolean runTest(javax.net.ssl.SSLContext sslClientContext, javax.net.ssl.SSLContext sslServerContext) throws java.io.IOException, java.lang.InterruptedException
sslClientContext
- SSLContext to be used by the client.sslServerContext
- SSLContext to be used by the server.
SSLContextFactoryException
java.io.IOException
java.lang.InterruptedException
protected java.lang.Exception makeClientRequest(javax.net.ssl.SSLContext sslClientContext) throws java.io.IOException
sslClientSocketFactory
-
java.io.IOException
protected java.lang.Throwable printSslException(java.lang.String prefix, javax.net.ssl.SSLException sslException, javax.net.ssl.SSLSocket socket)
prefix
- sslException
- socket
-
protected void printSslSocketInfo(javax.net.ssl.SSLSocket socket)
socket
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |