@Override
  public Socket createSocket() throws IOException {
    Socket tcpSocket = super.createSocket();

    SSLSocket sslSocket = null;

    try {
      sslSocket = (SSLSocket) sslSocketFactory.createSocket(tcpSocket, host, port, true);

      ArrayList<String> protocolsList = Utils.splitString(sslConfig.sslEnabledProtocols, ",");
      if (!protocolsList.isEmpty()) {
        String[] enabledProtocols = protocolsList.toArray(new String[protocolsList.size()]);
        sslSocket.setEnabledProtocols(enabledProtocols);
      }

      ArrayList<String> cipherSuitesList = Utils.splitString(sslConfig.sslCipherSuites, ",");
      if (!cipherSuitesList.isEmpty()) {
        String[] cipherSuites = cipherSuitesList.toArray(new String[cipherSuitesList.size()]);
        sslSocket.setEnabledCipherSuites(cipherSuites);
      }

      // handshake in a blocking way
      sslSocket.startHandshake();
      sslClientHandshakeCount.inc();
    } catch (IOException e) {
      sslClientHandshakeErrorCount.inc();
      tcpSocket.setSoLinger(true, 0);
      tcpSocket.close();
      throw e;
    }

    logger.debug(
        "Converted socket to SSL with enabled protocols {} and ciphers {}",
        sslSocket.getEnabledProtocols(),
        sslSocket.getEnabledCipherSuites()
    );

    return sslSocket;
  }
Calls BlockingChannel's createSocket() to create and connect a new TCP socket,
then wraps it inside an SSLSocket
@return Socket
@throws IOException
ambry-network/src/main/java/com/github/ambry/network/SSLBlockingChannel.java