MockDTLSClient (Bouncy Castle Library 1.52 API Specification)
Date: 2015-03-01

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

- All Implemented Interfaces:
    TlsClient, TlsPeer

      public class MockDTLSClient
      extends DefaultTlsClient

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected TlsSession` | `session`

    - ### Fields inherited from class org.bouncycastle.crypto.tls.AbstractTlsClient

      `cipherFactory, clientECPointFormats, context, namedCurves, selectedCipherSuite, selectedCompressionMethod, serverECPointFormats, supportedSignatureAlgorithms`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MockDTLSClient(TlsSession session)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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, getCipher, getCipherSuites, getKeyExchange`

    - ### Methods inherited from class org.bouncycastle.crypto.tls.AbstractTlsClient

      `allowUnexpectedServerExtension, checkForUnexpectedServerExtension, getClientHelloRecordLayerVersion, getClientSupplementalData, getCompression, getCompressionMethods, init, isFallback, notifyNewSessionTicket, notifySelectedCipherSuite, notifySelectedCompressionMethod, notifySessionID, processServerExtensions, processServerSupplementalData`

    - ### Methods inherited from class org.bouncycastle.crypto.tls.AbstractTlsPeer

      `notifySecureRenegotiation, 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, 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 interface `TlsClient`
      Overrides:
        `getSessionToResume` in class `AbstractTlsClient`
      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 interface `TlsPeer`
      Overrides:
        `notifyAlertRaised` in class `AbstractTlsPeer`
      Parameters:
        `alertLevel` - `AlertLevel`
        `alertDescription` - `AlertDescription`
        `message` - A human-readable message explaining what caused this alert. May be null.
        `cause` - The `Throwable` 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 interface `TlsPeer`
      Overrides:
        `notifyAlertReceived` in class `AbstractTlsPeer`
      Parameters:
        `alertLevel` - `AlertLevel`
        `alertDescription` - `AlertDescription`

    - #### getClientVersion

          public ProtocolVersion getClientVersion()

      Specified by:
        `getClientVersion` in interface `TlsClient`
      Overrides:
        `getClientVersion` in class `AbstractTlsClient`

    - #### getMinimumVersion

          public ProtocolVersion getMinimumVersion()

      Overrides:
        `getMinimumVersion` in class `AbstractTlsClient`

    - #### getClientExtensions

          public java.util.Hashtable getClientExtensions()
                                                  throws java.io.IOException

      Specified by:
        `getClientExtensions` in interface `TlsClient`
      Overrides:
        `getClientExtensions` in class `AbstractTlsClient`
      Throws:
        `java.io.IOException`

    - #### notifyServerVersion

          public void notifyServerVersion(ProtocolVersion serverVersion)
                                   throws java.io.IOException

      Specified by:
        `notifyServerVersion` in interface `TlsClient`
      Overrides:
        `notifyServerVersion` in class `AbstractTlsClient`
      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 interface `TlsPeer`
      Overrides:
        `notifyHandshakeComplete` in class `AbstractTlsPeer`
      Throws:
        `java.io.IOException`