+ /**
+ * Returns the time taken to complete a handshake.
+ */
+ virtual std::chrono::nanoseconds getHandshakeTime() const {
+ return handshakeEndTime_ - handshakeStartTime_;
+ }
+
+ void setMinWriteSize(size_t minWriteSize) {
+ minWriteSize_ = minWriteSize;
+ }
+
+ size_t getMinWriteSize() const {
+ return minWriteSize_;
+ }
+
+ void setReadCB(ReadCallback* callback) override;
+
+ /**
+ * Tries to enable the buffer movable experimental feature in openssl.
+ * This is not guaranteed to succeed in case openssl does not have
+ * the experimental feature built in.
+ */
+ void setBufferMovableEnabled(bool enabled);
+
+ /**
+ * Returns the peer certificate, or nullptr if no peer certificate received.
+ */
+ ssl::X509UniquePtr getPeerCert() const override {
+ if (!ssl_) {
+ return nullptr;
+ }
+
+ X509* cert = SSL_get_peer_certificate(ssl_);
+ return ssl::X509UniquePtr(cert);
+ }
+
+ /**
+ * Force AsyncSSLSocket object to cache local and peer socket addresses.
+ * If called with "true" before connect() this function forces full local
+ * and remote socket addresses to be cached in the socket object and available
+ * through getLocalAddress()/getPeerAddress() methods even after the socket is
+ * closed.
+ */
+ void forceCacheAddrOnFailure(bool force) { cacheAddrOnFailure_ = force; }
+
+ const std::string& getServiceIdentity() const { return serviceIdentity_; }
+
+ void setServiceIdentity(std::string serviceIdentity) {
+ serviceIdentity_ = std::move(serviceIdentity);
+ }
+
+ void setCertCacheHit(bool hit) {
+ certCacheHit_ = hit;
+ }
+
+ bool getCertCacheHit() const {
+ return certCacheHit_;
+ }
+
+ bool sessionResumptionAttempted() const {
+ return sessionResumptionAttempted_;
+ }
+
+ /**
+ * If the SSL socket was used to connect as well
+ * as establish an SSL connection, this gives the total
+ * timeout for the connect + SSL connection that was
+ * set.
+ */
+ std::chrono::milliseconds getTotalConnectTimeout() const {
+ return totalConnectTimeout_;
+ }
+
+ private:
+
+ void init();
+