Package org.bouncycastle.crypto.tls.test
Class MockDTLSClient
- java.lang.Object
-
- org.bouncycastle.crypto.tls.AbstractTlsPeer
-
- org.bouncycastle.crypto.tls.AbstractTlsClient
-
- org.bouncycastle.crypto.tls.DefaultTlsClient
-
- org.bouncycastle.crypto.tls.test.MockDTLSClient
-
public class MockDTLSClient extends DefaultTlsClient
-
-
Field Summary
Fields Modifier and Type Field Description protected TlsSession
session
-
Fields inherited from class org.bouncycastle.crypto.tls.DefaultTlsClient
dhVerifier
-
Fields inherited from class org.bouncycastle.crypto.tls.AbstractTlsClient
cipherFactory, clientECPointFormats, context, namedCurves, selectedCipherSuite, selectedCompressionMethod, serverECPointFormats, supportedSignatureAlgorithms
-
-
Constructor Summary
Constructors Constructor Description MockDTLSClient(TlsSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TlsAuthentication
getAuthentication()
java.util.Hashtable
getClientExtensions()
ProtocolVersion
getClientVersion()
ProtocolVersion
getMinimumVersion()
TlsSession
getSessionToResume()
Return the session this client wants to resume, if any.void
notifyAlertRaised(short alertLevel, short alertDescription, java.lang.String message, java.lang.Throwable cause)
This method will be called when an alert is raised by the protocol.void
notifyAlertReceived(short alertLevel, short alertDescription)
This method will be called when an alert is received from the remote peer.void
notifyHandshakeComplete()
Notifies the peer that the handshake has been successfully completed.void
notifyServerVersion(ProtocolVersion serverVersion)
-
Methods inherited from class org.bouncycastle.crypto.tls.DefaultTlsClient
createDHEKeyExchange, createDHKeyExchange, createECDHEKeyExchange, createECDHKeyExchange, createRSAKeyExchange, getCipherSuites, getKeyExchange
-
Methods inherited from class org.bouncycastle.crypto.tls.AbstractTlsClient
allowUnexpectedServerExtension, checkForUnexpectedServerExtension, getCipher, getClientHelloRecordLayerVersion, getClientSupplementalData, getCompression, getCompressionMethods, init, isFallback, notifyNewSessionTicket, notifySelectedCipherSuite, notifySelectedCompressionMethod, notifySessionID, processServerExtensions, processServerSupplementalData
-
Methods inherited from class org.bouncycastle.crypto.tls.AbstractTlsPeer
notifySecureRenegotiation, requiresExtendedMasterSecret, shouldUseGMTUnixTime
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bouncycastle.crypto.tls.TlsPeer
notifySecureRenegotiation, requiresExtendedMasterSecret, shouldUseGMTUnixTime
-
-
-
-
Field Detail
-
session
protected TlsSession session
-
-
Constructor Detail
-
MockDTLSClient
public MockDTLSClient(TlsSession session)
-
-
Method Detail
-
getSessionToResume
public TlsSession getSessionToResume()
Description copied from interface:TlsClient
Return the session this client wants to resume, if any. Note that the peer's certificate chain for the session (if any) may need to be periodically revalidated.- Specified by:
getSessionToResume
in interfaceTlsClient
- Overrides:
getSessionToResume
in classAbstractTlsClient
- Returns:
- A
TlsSession
representing the resumable session to be used for this connection, or null to use a new session. - See Also:
SessionParameters.getPeerCertificate()
-
notifyAlertRaised
public void notifyAlertRaised(short alertLevel, short alertDescription, java.lang.String message, java.lang.Throwable cause)
Description copied from interface:TlsPeer
This method will be called when an alert is raised by the protocol.- Specified by:
notifyAlertRaised
in interfaceTlsPeer
- Overrides:
notifyAlertRaised
in classAbstractTlsPeer
- Parameters:
alertLevel
-AlertLevel
alertDescription
-AlertDescription
message
- A human-readable message explaining what caused this alert. May be null.cause
- TheThrowable
that caused this alert to be raised. May be null.
-
notifyAlertReceived
public void notifyAlertReceived(short alertLevel, short alertDescription)
Description copied from interface:TlsPeer
This method will be called when an alert is received from the remote peer.- Specified by:
notifyAlertReceived
in interfaceTlsPeer
- Overrides:
notifyAlertReceived
in classAbstractTlsPeer
- Parameters:
alertLevel
-AlertLevel
alertDescription
-AlertDescription
-
getClientVersion
public ProtocolVersion getClientVersion()
- Specified by:
getClientVersion
in interfaceTlsClient
- Overrides:
getClientVersion
in classAbstractTlsClient
-
getMinimumVersion
public ProtocolVersion getMinimumVersion()
- Overrides:
getMinimumVersion
in classAbstractTlsClient
-
getClientExtensions
public java.util.Hashtable getClientExtensions() throws java.io.IOException
- Specified by:
getClientExtensions
in interfaceTlsClient
- Overrides:
getClientExtensions
in classAbstractTlsClient
- Throws:
java.io.IOException
-
notifyServerVersion
public void notifyServerVersion(ProtocolVersion serverVersion) throws java.io.IOException
- Specified by:
notifyServerVersion
in interfaceTlsClient
- Overrides:
notifyServerVersion
in classAbstractTlsClient
- Throws:
java.io.IOException
-
getAuthentication
public TlsAuthentication getAuthentication() throws java.io.IOException
- Throws:
java.io.IOException
-
notifyHandshakeComplete
public void notifyHandshakeComplete() throws java.io.IOException
Description copied from interface:TlsPeer
Notifies the peer that the handshake has been successfully completed.- Specified by:
notifyHandshakeComplete
in interfaceTlsPeer
- Overrides:
notifyHandshakeComplete
in classAbstractTlsPeer
- Throws:
java.io.IOException
-
-