Examples of HttpHost


Examples of org.apache.http.HttpHost

    public void testDeleteClosedConnections()
            throws InterruptedException, ConnectionPoolTimeoutException {
       
        ThreadSafeClientConnManager mgr = createTSCCM(null, null);

        HttpHost target = new HttpHost("www.test.invalid", 80, "http");
        HttpRoute route = new HttpRoute(target, null, false);

        ManagedClientConnection conn = getConnection(mgr, route);

        assertEquals("connectionsInPool",
View Full Code Here

Examples of org.quickserver.net.client.HttpHost

  private TrustManager[] trustManager;
  private SSLContext sslContext;

  public char monitor(Host host) {
    HttpHost httpHost = (HttpHost) host;
    HttpURLConnection http = null;
    BufferedInputStream bis = null;
    try {
      String urlString = null;

      if (httpHost.isSecure()) {
        urlString = "https://";
      } else {
        urlString = "http://";
      }
      urlString = urlString + httpHost.getInetAddress().getHostAddress()
          + ":" + httpHost.getInetSocketAddress().getPort() + httpHost.getUri();

      URL url = new URL(urlString);
      http = (HttpURLConnection) url.openConnection();
      if (httpHost.isSecure()) {
        HttpsURLConnection https = (HttpsURLConnection) http;

        makeSSLSocketFactory();

        https.setSSLSocketFactory(sslSocketFactory);
        https.setHostnameVerifier(vf);
      }
      http.setRequestMethod("GET");
      http.setDoOutput(true);
      http.setReadTimeout(httpHost.getTimeout());

      http.connect();

      String httpResponseCode = "" + http.getResponseCode();
      if(httpResponseCode.equals(httpHost.getHttpStatusCode())==false) {
        logger.fine("StatusCode does not match.. got "+httpResponseCode+
            ", expected: "+httpHost.getHttpStatusCode());
        return Host.DOWN;
      }

      if (httpHost.getTextToExpect() != null) {
        InputStream is = http.getErrorStream();
        if(is==null) {
          is = http.getInputStream();
        }
        bis = new BufferedInputStream(is);
       
        String textGot = new String(BlockingClient.readInputStream(bis), "utf-8");
        if (textGot.indexOf(httpHost.getTextToExpect()) != -1) {
          return Host.ACTIVE;
        } else {
          logger.fine(httpHost + " Error: Text [" + httpHost.getTextToExpect()
              + "]Not found! Got: " + textGot);
          return Host.DOWN;
        }
      } else {
        return Host.ACTIVE;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.