code: public void checkKeyStore() {
          if (sslContext != null)
              return; //nothing to check if using preconfigured context
          
          if (keyStoreInputStream == null &&
  	    sslConfig.getKeyStorePath() == null) {
              throw new IllegalStateException("SSL doesn't have a valid keystore");
          }
          // if the keystore has been configured but there is no
          // truststore configured, use the keystore as the truststore
          if (trustStoreInputStream == null && sslConfig.getTrustStorePath() == null) {
              trustStoreInputStream = keyStoreInputStream;
              sslConfig.setTrustStorePath(sslConfig.getKeyStorePath());
              sslConfig.setTrustStoreType(sslConfig.getKeyStoreType());
              sslConfig.setTrustStoreProvider(sslConfig.getKeyStoreProvider());
              sslConfig.setTrustStorePassword(sslConfig.getKeyStorePassword());
              sslConfig.setTrustManagerFactoryAlgorithm(sslConfig.getKeyManagerFactoryAlgorithm());
          }
  
          // It's the same stream we cannot read it twice, so read it once in memory
          if (keyStoreInputStream != null && keyStoreInputStream == trustStoreInputStream) {
              try {
                  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  		streamCopy(keyStoreInputStream, baos, null, false);
                  keyStoreInputStream.close();
                  keyStoreInputStream = new ByteArrayInputStream(baos.toByteArray());
                  trustStoreInputStream = new ByteArrayInputStream(baos.toByteArray());
              } catch (Exception ex) {
                  throw new IllegalStateException(ex);
              }
          }
      }
docs: Check KeyStore Configuration. Ensures that if keystore has been
  configured but there's no truststore, that keystore is
  used as truststore.
  @throws IllegalStateException if SslContextFactory configuration can't be used.