Refactored host and port to local variables.

This commit is contained in:
Simone Bordet 2014-08-12 18:06:11 +02:00
parent 814c84a212
commit 20963c9c61
1 changed files with 5 additions and 2 deletions

View File

@ -47,13 +47,16 @@ public class Client
client.addBean(sslContextFactory);
client.start();
String host = "webtide.com";
int port = 443;
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);
HttpFields requestFields = new HttpFields();
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);
final CountDownLatch latch = new CountDownLatch(1);
session.newStream(headersFrame, new Promise.Adapter<Stream>(), new Stream.Listener.Adapter()