public abstract class MiniSslClientServer extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
MiniSslClientServer.RequestHandler
Small class that handles a server request.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CERTIFICATES_DIRECTORY |
static String |
KEYSTORE_PASSWORD |
protected Exception |
listeningServerException |
protected LinkedBlockingQueue<Future<Object>> |
serverRequestsFutures |
protected int |
serverTimeout |
protected boolean |
stopServer |
protected int |
testPort |
protected boolean |
verboseExceptions |
| Constructor and Description |
|---|
MiniSslClientServer() |
| Modifier and Type | Method and Description |
|---|---|
KeyStore |
getBadClientCertKeyStore()
Returns the keystore containing a test key and certificate that is not to
be trusted by the server when CRLs are enabled.
|
KeyStore |
getCaKeyStore()
Returns the store of CA certificates, to be used as a trust store.
|
protected String |
getCertificatesDirectory() |
KeyStore |
getGoodClientCertKeyStore()
Returns the keystore containing a test key and certificate that is to be
trusted by the server.
|
Collection<X509CRL> |
getLocalCRLs()
Returns a collection of CRLs to be used by the tests.
|
KeyStore |
getServerCertKeyStore()
Returns the keystore containing the key and the certificate to be used by
the server.
|
protected Exception |
makeClientRequest(SSLContext sslClientContext) |
protected SSLServerSocket |
prepareServerSocket(SSLContext sslServerContext)
Creates and binds the SSLServerSocket to a port after trying a few port
numbers.
|
protected Throwable |
printSslException(String prefix,
SSLException sslException,
SSLSocket socket)
Used for printing out more info when there's a problem.
|
protected void |
printSslSocketInfo(SSLSocket socket)
Used for printing out more info when there's a problem.
|
protected Thread |
runServer(SSLServerSocket serverSocket)
Starts the mini server.
|
boolean |
runTest(SSLContext sslClientContext,
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.
|
public static final String CERTIFICATES_DIRECTORY
public static final String KEYSTORE_PASSWORD
protected volatile boolean stopServer
protected boolean verboseExceptions
protected volatile int serverTimeout
protected int testPort
protected final LinkedBlockingQueue<Future<Object>> serverRequestsFutures
protected volatile Exception listeningServerException
protected String getCertificatesDirectory()
public KeyStore getCaKeyStore() throws IOException, NoSuchAlgorithmException, KeyStoreException, CertificateException
IOExceptionNoSuchAlgorithmExceptionKeyStoreExceptionCertificateExceptionpublic KeyStore getServerCertKeyStore() throws IOException, NoSuchAlgorithmException, KeyStoreException, CertificateException
IOExceptionNoSuchAlgorithmExceptionKeyStoreExceptionCertificateExceptionpublic KeyStore getGoodClientCertKeyStore() throws IOException, NoSuchAlgorithmException, KeyStoreException, CertificateException
IOExceptionNoSuchAlgorithmExceptionKeyStoreExceptionCertificateExceptionpublic KeyStore getBadClientCertKeyStore() throws IOException, NoSuchAlgorithmException, KeyStoreException, CertificateException
IOExceptionNoSuchAlgorithmExceptionKeyStoreExceptionCertificateExceptionpublic Collection<X509CRL> getLocalCRLs() throws IOException, NoSuchAlgorithmException, KeyStoreException, CertificateException, CRLException
IOExceptionNoSuchAlgorithmExceptionKeyStoreExceptionCertificateExceptionCRLExceptionprotected void setServerRequestNumber(int serverRequestNumber)
serverRequestNumber - protected SSLServerSocket prepareServerSocket(SSLContext sslServerContext)
sslServerContext - SSLContext from which to build the socket and its
SSLSocketFactory.protected Thread runServer(SSLServerSocket serverSocket)
serverSocket - bound SSLServerSocket for this server.public boolean runTest(SSLContext sslClientContext, SSLContext sslServerContext) throws IOException, InterruptedException
sslClientContext - SSLContext to be used by the client.sslServerContext - SSLContext to be used by the server.SSLContextFactoryExceptionIOExceptionInterruptedExceptionprotected Exception makeClientRequest(SSLContext sslClientContext) throws IOException
sslClientSocketFactory - IOExceptionprotected Throwable printSslException(String prefix, SSLException sslException, SSLSocket socket)
prefix - sslException - socket - protected void printSslSocketInfo(SSLSocket socket)
socket - Copyright © 2017. All rights reserved.