Refactored host and port to local variables.
This commit is contained in:
parent
814c84a212
commit
20963c9c61
|
@ -47,13 +47,16 @@ public class Client
|
||||||
client.addBean(sslContextFactory);
|
client.addBean(sslContextFactory);
|
||||||
client.start();
|
client.start();
|
||||||
|
|
||||||
|
String host = "webtide.com";
|
||||||
|
int port = 443;
|
||||||
|
|
||||||
FuturePromise<Session> sessionPromise = new FuturePromise<>();
|
FuturePromise<Session> sessionPromise = new FuturePromise<>();
|
||||||
client.connect(sslContextFactory, new InetSocketAddress("webtide.com", 443), new ServerSessionListener.Adapter(), sessionPromise);
|
client.connect(sslContextFactory, new InetSocketAddress(host, port), new ServerSessionListener.Adapter(), sessionPromise);
|
||||||
Session session = sessionPromise.get(5, TimeUnit.SECONDS);
|
Session session = sessionPromise.get(5, TimeUnit.SECONDS);
|
||||||
|
|
||||||
HttpFields requestFields = new HttpFields();
|
HttpFields requestFields = new HttpFields();
|
||||||
requestFields.put("User-Agent", client.getClass().getName() + "/" + Jetty.VERSION);
|
requestFields.put("User-Agent", client.getClass().getName() + "/" + Jetty.VERSION);
|
||||||
MetaData.Request metaData = new MetaData.Request("GET", new HttpURI("https://webtide.com/"), HttpVersion.HTTP_2, requestFields);
|
MetaData.Request metaData = new MetaData.Request("GET", new HttpURI("https://" + host + ":" + port + "/"), HttpVersion.HTTP_2, requestFields);
|
||||||
HeadersFrame headersFrame = new HeadersFrame(0, metaData, null, true);
|
HeadersFrame headersFrame = new HeadersFrame(0, metaData, null, true);
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
session.newStream(headersFrame, new Promise.Adapter<Stream>(), new Stream.Listener.Adapter()
|
session.newStream(headersFrame, new Promise.Adapter<Stream>(), new Stream.Listener.Adapter()
|
||||||
|
|
Loading…
Reference in New Issue