Skip to content

Instantly share code, notes, and snippets.

@Exagone313
Created February 1, 2016 12:38
Show Gist options
  • Save Exagone313/86082513281176ac1f7b to your computer and use it in GitHub Desktop.
Save Exagone313/86082513281176ac1f7b to your computer and use it in GitHub Desktop.
package exa.gone;
import org.eclipse.jetty.client.HttpClient;
public class Main {
public static void main(String[] args) {
HttpClient httpClient = new HttpClient();
try {
httpClient.newRequest("http://127.0.0.1:81/")
.send(System.out::println);
} catch(Exception e) {
e.printStackTrace();
}
}
}
/*
java.lang.NullPointerException
at org.eclipse.jetty.client.HttpDestination.newExchangeQueue(HttpDestination.java:92)
at org.eclipse.jetty.client.HttpDestination.<init>(HttpDestination.java:65)
at org.eclipse.jetty.client.PoolingHttpDestination.<init>(PoolingHttpDestination.java:39)
at org.eclipse.jetty.client.http.HttpDestinationOverHTTP.<init>(HttpDestinationOverHTTP.java:30)
at org.eclipse.jetty.client.http.HttpClientTransportOverHTTP.newHttpDestination(HttpClientTransportOverHTTP.java:48)
at org.eclipse.jetty.client.HttpClient.destinationFor(HttpClient.java:499)
at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:537)
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:694)
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:678)
at exa.gone.Main.main(Main.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment