我正在关注Jetty HttpClient Example,但我无法获得SSL连接的工作。当我使用代理进行连接时,它会引发“未实现”异常。当我不使用代理时,它不会返回任何内容。使用SSL的Jetty HTTP客户端
HttpClient client = new HttpClient(); client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); client.setProxy(new Address("www.example.com", 80)); client.start(); // create the exchange object, which lets you define where you want to go // and what you want to do once you get a response ContentExchange exchange = new ContentExchange() { // define the callback method to process the response when you get it // back protected void onResponseComplete() throws IOException { super.onResponseComplete(); String responseContent = this.getResponseContent(); // do something with the response content System.out.println(responseContent); } }; exchange.setMethod("GET"); exchange.setURL("https://www.example.com"); exchange.setScheme(HttpSchemes.HTTPS_BUFFER); // start the exchange client.send(exchange); exchange.waitForDone(); System.err.println("Response status: " + exchange.getResponseStatus());
哪个码头的客户端版本您使用的? – Jon 2009-06-16 19:09:30