Alguém já implementou um client HTTP/2 pra mostrar um caminho?
Já pesquise Jetty e OkHttp mas não consigo fazer um request POST.
Estou tentando mas dá NulPointerException:
HTTP2Client http2Client = new HTTP2Client();
http2Client.start();
KeyStore ks = KeyStore.getInstance("PKCS12");
// Ensure that the password is the same as the one used later in setKeyStorePassword()
ks.load(new FileInputStream("path_arquivo.pfx"), "senha".toCharArray());
SslContextFactory ssl = new SslContextFactory();
ssl.setKeyStore(ks);
client = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), ssl);
client.start();
Request req = client.POST(this.URL_POST)
.content(new StringContentProvider("{ \"aps\" : { \"alert\" : \"Hello\" } }"));
ContentResponse response = req.send();
System.out.println("response code: " + response.getStatus());