title: TLS/SSL with Wildfly 16.0.0.Final and ejb client fails with org.xnio.http.UpgradeFailedException: Invalid response code 200
body: <p>I have setup an EJB client that can connect successfuly to <code>remote+http://localhost:8080</code> without SSL/TLS.</p>
  
  <p>Now I have created a truststore and keystore and followed the instructions in the Wildfly documentation <a href="https://docs.jboss.org/author/display/WFLY/WildFly+Elytron+Security#WildFlyElytronSecurity-EnableOnewaySSL%2FTLSforApplications" rel="nofollow noreferrer">here</a> to setup SSL/TLS.</p>
  
  <p>My <code>wildfly-config.xml</code> contains the following:</p>
  
  <pre><code>&lt;authentication-client xmlns="urn:elytron:1.0"&gt;
      &lt;authentication-rules&gt;
          &lt;rule use-configuration="default-config"/&gt;
      &lt;/authentication-rules&gt;
      &lt;authentication-configurations&gt;
          &lt;configuration name="default-config"&gt;
              &lt;set-user-name name="${user}"/&gt;
              &lt;credentials&gt;
                  &lt;clear-password password="${password}"/&gt;
              &lt;/credentials&gt;
              &lt;sasl-mechanism-selector selector="#ALL" /&gt;
              &lt;providers&gt;
                  &lt;use-service-loader /&gt;
              &lt;/providers&gt;
          &lt;/configuration&gt;
      &lt;/authentication-configurations&gt;
  
      &lt;key-stores&gt;
          &lt;key-store name="im-keystore" type="JKS"&gt;
              &lt;file name="client.truststore"/&gt;
              &lt;key-store-clear-password password="xxx"/&gt;
          &lt;/key-store&gt;
      &lt;/key-stores&gt;
  
      &lt;ssl-contexts&gt;
          &lt;ssl-context name="im-ssl-context"&gt;
              &lt;trust-store key-store-name="im-keystore"/&gt;
              &lt;protocol names="TLSv1.2"/&gt;
          &lt;/ssl-context&gt;
      &lt;/ssl-contexts&gt;
  
      &lt;ssl-context-rules&gt;
          &lt;rule use-ssl-context="im-ssl-context"/&gt;
      &lt;/ssl-context-rules&gt;
  &lt;/authentication-client&gt;
  </code></pre>
  
  <p>The server is configured as follows:</p>
  
  <pre><code>&lt;tls&gt;
      &lt;key-stores&gt;
          &lt;key-store name="httpsKS"&gt;
              &lt;credential-reference clear-text="xxx"/&gt;
              &lt;implementation type="JKS"/&gt;
              &lt;file path="server.keystore" relative-to="jboss.server.config.dir"/&gt;
          &lt;/key-store&gt;
      &lt;/key-stores&gt;
      &lt;key-managers&gt;
          &lt;key-manager name="httpsKM" key-store="httpsKS"&gt;
              &lt;credential-reference clear-text="xxx"/&gt;
          &lt;/key-manager&gt;
      &lt;/key-managers&gt;
      &lt;server-ssl-contexts&gt;
          &lt;server-ssl-context name="httpsSSC" protocols="TLSv1.2" key-manager="httpsKM"/&gt;
      &lt;/server-ssl-contexts&gt;
  &lt;/tls&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;https-listener name="https" socket-binding="https" ssl-context="httpsSSC" enable-http2="true"/&gt;
  </code></pre>
  
  <p>Now the ejb client throws the following exception when connecting to <code>remote+https://localhost:8443</code>:</p>
  
  <pre><code>LOG 2019-06-13T12:12:56Z [XNIO-1 task-1] TRACE org.jboss.remoting.endpoint - Registered exception result
  org.xnio.http.UpgradeFailedException: Invalid response code 200
      at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:471) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final]
      at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:400) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final]
      at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final]
      at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final]
      at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89) ~[xnio-nio-3.6.5.Final.jar:3.6.5.Final]
      at org.xnio.nio.WorkerThread.run(WorkerThread.java:591) ~[xnio-nio-3.6.5.Final.jar:3.6.5.Final]
  </code></pre>
  
  <p>Any ideas?</p>