Skip to content

Instantly share code, notes, and snippets.

@CodingFabian
Created March 18, 2016 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodingFabian/aed1c975104ccef3ceb2 to your computer and use it in GitHub Desktop.
Save CodingFabian/aed1c975104ccef3ceb2 to your computer and use it in GitHub Desktop.
HTTP2Client client = new HTTP2Client();
SslContextFactory sslContextFactory = new SslContextFactory(true);
HTTP2ClientConnectionFactory h2 = new HTTP2ClientConnectionFactory();
client.setClientConnectionFactory(h2);
client.addBean(h2);
client.addBean(sslContextFactory);
client.start();
FuturePromise<Session> sessionPromise = new FuturePromise<>();
client.connect(sslContextFactory, new InetSocketAddress(host, port), new ServerSessionListener.Adapter(), sessionPromise);
Session session = sessionPromise.get(5, TimeUnit.SECONDS);
HttpFields requestFields = new HttpFields();
MetaData.Request metaData = new MetaData.Request("GET", new HttpURI("https://" + host + ":" + port + "/"),
HttpVersion.HTTP_2, requestFields);
HeadersFrame headersFrame = new HeadersFrame(metaData, null, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment