<div dir="ltr">Hi Stuart,<div><br></div><div>I debugged into the ALPN code and found some issues with Http2Client. </div><div><br></div><div>I started with the Http2Server example and found LoadBalancingProxyClient is using an instance of UndertowClient which can only load HTTP1.1 ClientProviders. The following is the code to get ClientProvider and only "http" or "https" can be the return from uri.getSchema().</div><div><br></div><div><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">ClientProvider provider = <span style="color:rgb(102,14,122);font-weight:bold">clientProviders</span>.get(uri.getScheme());<br></pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">If this is true, then the communication between the proxy and Http/2 server is Http/1.1</pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">In addition, I have created a new class UndertowHttp2Client and Http2ClientTestCase in my forked repo to try </pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">the Http2ClientProviders and found all three http2 client providers don't work as expected. </pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">h2c and h2-prior got 200 response code back during handshake and h2 works but the connection is still http 1.1</pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">I am debugging the ALPN code now but it is very slow as I have to dig into the spec to learn how the handshake works. </pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">As you have resolved the ALPN boot jar issue with the hack, I think Undertow is very usable for HTTP/2 and it would</pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">be perfect if the client is working as well. Could you please confirm my findings and let me know direction I should</pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">focus on? </pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt"><br></pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">Thanks,</pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt"><br></pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">Steve</pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt"><br></pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt">Here is my repo with UndertowHttp2Client and Test. </pre><pre><font color="#000000" face="menlo"><a href="https://github.com/stevehu/undertow">https://github.com/stevehu/undertow</a><span style="font-size:9pt"><br></span></font></pre><pre><font color="#000000" face="menlo"><br></font></pre><pre><font color="#000000" face="menlo">And here is the files I have added. </font></pre><pre><font color="#000000" face="menlo"><a href="https://github.com/stevehu/undertow/blob/master/core/src/main/java/io/undertow/client/UndertowHttp2Client.java">https://github.com/stevehu/undertow/blob/master/core/src/main/java/io/undertow/client/UndertowHttp2Client.java</a><br></font></pre><pre><font color="#000000" face="menlo"><a href="https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java">https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java</a><br></font></pre><pre><font color="#000000" face="menlo"><br></font></pre><pre><font color="#000000" face="menlo"><br></font></pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt"><br></pre><pre style="color:rgb(0,0,0);font-family:menlo;font-size:9pt"><br></pre></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas <span dir="ltr"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I don't really have time to do it (there is no real benefit for<br>
Undertow, so it is not high on my priority list), but the code is all<br>
Apache licensed so there is no reason why you can't start a project<br>
that provides this code as a standalone implementation.<br>
<br>
You would still need to implement code in Netty etc to actually use<br>
this as well, as there is no standardized ALPN API yet.<br>
<span class="HOEnZb"><font color="#888888"><br>
Stuart<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu <<a href="mailto:stevehu@gmail.com">stevehu@gmail.com</a>> wrote:<br>
> I am reading the code in client package and they look really good. As<br>
> currently none of the http/2 client library has a work around on alpn boot<br>
> jar and this blocks majority of developers to move to http/2. I am wondering<br>
> if you want to split client package to a standalone client module so that it<br>
> can be used by other developers to connect to servers that implement http/2.<br>
> If you are interested in it, I can help to create a pull request and add<br>
> some test cases while I am working on my own client implementation. Thanks.<br>
><br>
> On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>> wrote:<br>
>><br>
>> You could use Undertow's HTTP/2 client, although it's API was designed<br>
>> around the reverse proxy use case and as a result is not ideal for the<br>
>> general purpose HTTP client use case (although it is still perfectly<br>
>> usable).<br>
>><br>
>> In terms of using Undertow's ALPN implementation with Netty etc it<br>
>> would require someone to port it over. The code is at [1] if you are<br>
>> interested.<br>
>><br>
>> Stuart<br>
>><br>
>> [1]<br>
>> <a href="https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java" rel="noreferrer" target="_blank">https://github.com/undertow-<wbr>io/undertow/blob/master/core/<wbr>src/main/java/io/undertow/<wbr>protocols/ssl/<wbr>ALPNHackSSLEngine.java</a><br>
>><br>
>> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu <<a href="mailto:stevehu@gmail.com">stevehu@gmail.com</a>> wrote:<br>
>> > Thanks Stuart for the quick response. Now I have server started with<br>
>> > HTTP/2<br>
>> > and it works perfect with some client tools. Now I am looking for Java<br>
>> > HTTP/2 client libraries to update my client module to support HTTP/2<br>
>> > protocol for microservices communication. There are three major<br>
>> > libraries<br>
>> > okhttp, jetty and netty but all of them require Jetty's ALPN boot JAR. I<br>
>> > saw<br>
>> > you have resolved the boot jar dependency in Undertow and am wondering<br>
>> > if<br>
>> > you could point me to the right direction. Do you have any<br>
>> > recommendation<br>
>> > for HTTP/2 client library? How do you work around the alpn boot jar? Is<br>
>> > the<br>
>> > same solution can be used by okhttp, jetty and netty before Java 9 is<br>
>> > released?<br>
>> ><br>
>> ><br>
>> ><br>
>> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> No, that is a debug level message. The JDK8 ALPN provider should still<br>
>> >> be registered.<br>
>> >><br>
>> >> Stuart<br>
>> >><br>
>> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu <<a href="mailto:stevehu@gmail.com">stevehu@gmail.com</a>> wrote:<br>
>> >> > Hi,<br>
>> >> ><br>
>> >> > I searched this mailing list and one post mentioned that I don't need<br>
>> >> > to<br>
>> >> > use<br>
>> >> > -Xbootclasspath/p:<path_to_<wbr>alpn_boot_jar> after 1.4.0Final. I am<br>
>> >> > trying<br>
>> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when I start<br>
>> >> > the<br>
>> >> > server I got the following error. Do I have to use OpenJDK 8? If I<br>
>> >> > switch to<br>
>> >> > JBoss OpenSSL implementation?<br>
>> >> ><br>
>> >> > Thanks,<br>
>> >> ><br>
>> >> > Steve<br>
>> >> ><br>
>> >> > 21:00:36.468 [main] DEBUG io.undertow - Configuring listener with<br>
>> >> > protocol<br>
>> >> > HTTPS for interface 0.0.0.0 and port 8843<br>
>> >> ><br>
>> >> > 21:00:36.486 [main] DEBUG io.undertow - JDK9 ALPN not supported<br>
>> >> ><br>
>> >> > java.lang.<wbr>NoSuchMethodException:<br>
>> >> ><br>
>> >> > javax.net.ssl.SSLParameters.<wbr>setApplicationProtocols([<wbr>Ljava.lang.String;)<br>
>> >> ><br>
>> >> > at java.lang.Class.getMethod(<wbr>Class.java:1786)<br>
>> >> ><br>
>> >> > at<br>
>> >> ><br>
>> >> ><br>
>> >> > io.undertow.protocols.alpn.<wbr>JDK9AlpnProvider$1.run(<wbr>JDK9AlpnProvider.java:47)<br>
>> >> ><br>
>> >> > at<br>
>> >> ><br>
>> >> ><br>
>> >> > io.undertow.protocols.alpn.<wbr>JDK9AlpnProvider$1.run(<wbr>JDK9AlpnProvider.java:43)<br>
>> >> ><br>
>> >> > at java.security.<wbr>AccessController.doPrivileged(<wbr>Native Method)<br>
>> >> ><br>
>> >> > at<br>
>> >> ><br>
>> >> ><br>
>> >> > io.undertow.protocols.alpn.<wbr>JDK9AlpnProvider.<clinit>(<wbr>JDK9AlpnProvider.java:43)<br>
>> >> ><br>
>> >> > at sun.reflect.<wbr>NativeConstructorAccessorImpl.<wbr>newInstance0(Native<br>
>> >> > Method)<br>
>> >> ><br>
>> >> > at<br>
>> >> ><br>
>> >> ><br>
>> >> > sun.reflect.<wbr>NativeConstructorAccessorImpl.<wbr>newInstance(<wbr>NativeConstructorAccessorImpl.<wbr>java:62)<br>
>> >> ><br>
>> >> > at<br>
>> >> ><br>
>> >> ><br>
>> >> > sun.reflect.<wbr>DelegatingConstructorAccessorI<wbr>mpl.newInstance(<wbr>DelegatingConstructorAccessorI<wbr>mpl.java:45)<br>
>> >> ><br>
>> >> > at java.lang.reflect.Constructor.<wbr>newInstance(Constructor.java:<wbr>423)<br>
>> >> ><br>
>> >> > at java.lang.Class.newInstance(<wbr>Class.java:442)<br>
>> >> ><br>
>> >> > at<br>
>> >> ><br>
>> >> > java.util.ServiceLoader$<wbr>LazyIterator.nextService(<wbr>ServiceLoader.java:380)<br>
>> >> ><br>
>> >> > at java.util.ServiceLoader$<wbr>LazyIterator.next(<wbr>ServiceLoader.java:404)<br>
>> >> ><br>
>> >> > at java.util.ServiceLoader$1.<wbr>next(ServiceLoader.java:480)<br>
>> >> ><br>
>> >> > at io.undertow.protocols.alpn.<wbr>ALPNManager.<init>(<wbr>ALPNManager.java:40)<br>
>> >> ><br>
>> >> > at<br>
>> >> > io.undertow.protocols.alpn.<wbr>ALPNManager.<clinit>(<wbr>ALPNManager.java:35)<br>
>> >> ><br>
>> >> > at<br>
>> >> ><br>
>> >> ><br>
>> >> > io.undertow.server.protocol.<wbr>http.AlpnOpenListener.<init>(<wbr>AlpnOpenListener.java:67)<br>
>> >> ><br>
>> >> > at<br>
>> >> ><br>
>> >> ><br>
>> >> > io.undertow.server.protocol.<wbr>http.AlpnOpenListener.<init>(<wbr>AlpnOpenListener.java:90)<br>
>> >> ><br>
>> >> > at io.undertow.Undertow.start(<wbr>Undertow.java:179)<br>
>> >> ><br>
>> >> > at com.networknt.server.Server.<wbr>start(Server.java:170)<br>
>> >> ><br>
>> >> > at com.networknt.server.Server.<wbr>main(Server.java:90)<br>
>> >> ><br>
>> >> > 21:00:36.503 [main] INFO com.networknt.server.Server - Https Server<br>
>> >> > started on ip:0.0.0.0 Port:8843<br>
>> >> ><br>
>> >> ><br>
>> >> > ______________________________<wbr>_________________<br>
>> >> > undertow-dev mailing list<br>
>> >> > <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
>> >> > <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div>