Examples of BasicHttpParams


Examples of org.apache.http.params.BasicHttpParams

    /**
     * get HTTP protocol parameters to which the listener must adhere to
     * @return the applicable HTTP protocol parameters
     */
    private HttpParams getListenerParameters() {
        HttpParams params = new BasicHttpParams();
        NHttpConfiguration cfg = NHttpConfiguration.getInstance();
        params
            .setIntParameter(HttpConnectionParams.SO_TIMEOUT,
                cfg.getProperty(HttpConnectionParams.SO_TIMEOUT, 60000))
            .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE,
                cfg.getProperty(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024))
            .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK,
                cfg.getProperty(HttpConnectionParams.STALE_CONNECTION_CHECK, 0) == 1)
            .setBooleanParameter(HttpConnectionParams.TCP_NODELAY,
                cfg.getProperty(HttpConnectionParams.TCP_NODELAY, 1) == 1)
            .setParameter(HttpProtocolParams.ORIGIN_SERVER, "Synapse-HttpComponents-NIO");

        if (cfg.getBooleanValue(NIOReactorPNames.INTEREST_OPS_QUEUEING, false)) {
            params.setBooleanParameter(NIOReactorPNames.INTEREST_OPS_QUEUEING, true);
        }
        return params;
    }
View Full Code Here

Examples of org.apache.http.params.BasicHttpParams

     * get HTTP protocol parameters to which the sender must adhere to
     * @return the applicable HTTP protocol parameters
     */
    private HttpParams getClientParameters() {
        NHttpConfiguration cfg = NHttpConfiguration.getInstance();
        HttpParams params = new BasicHttpParams();
        params
            .setIntParameter(HttpConnectionParams.SO_TIMEOUT,
                cfg.getProperty(HttpConnectionParams.SO_TIMEOUT, 60000))
            .setIntParameter(HttpConnectionParams.CONNECTION_TIMEOUT,
                cfg.getProperty(HttpConnectionParams.CONNECTION_TIMEOUT, 10000))
            .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE,
                cfg.getProperty(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024))
            .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK,
                cfg.getProperty(HttpConnectionParams.STALE_CONNECTION_CHECK, 0) == 1)
            .setBooleanParameter(HttpConnectionParams.TCP_NODELAY,
                cfg.getProperty(HttpConnectionParams.TCP_NODELAY, 1) == 1)
            .setParameter(HttpProtocolParams.USER_AGENT, "Synapse-HttpComponents-NIO");

        if (cfg.getBooleanValue(NIOReactorPNames.INTEREST_OPS_QUEUEING, false)) {
            params.setBooleanParameter(NIOReactorPNames.INTEREST_OPS_QUEUEING, true);
        }
        return params;
    }
View Full Code Here

Examples of org.apache.http.params.BasicHttpParams

  }

  private void doSimpleGetRequest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/");
    HttpResponse response = httpclient.execute(httpget);
    List<String> expectedHeaders = Arrays.asList(new String[] {"Server", "Date", "Content-Length", "Etag", "Connection"});
View Full Code Here

Examples of org.apache.http.params.BasicHttpParams

   */
  @Test
  public void wTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/w");
    HttpResponse response = httpclient.execute(httpget);

View Full Code Here

Examples of org.apache.http.params.BasicHttpParams

  @Test
  public void wwTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/ww");
    HttpResponse response = httpclient.execute(httpget);
View Full Code Here

Examples of org.apache.http.params.BasicHttpParams

  @Test
  public void wwfwTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/wwfw");
    HttpResponse response = httpclient.execute(httpget);
View Full Code Here

Examples of org.apache.http.params.BasicHttpParams

  @Test
  public void wfwfTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/wfwf");
    HttpResponse response = httpclient.execute(httpget);
View Full Code Here

Examples of org.apache.http.params.BasicHttpParams

 
  @Test
  public void wfffwfffTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/wfffwfff");
    HttpResponse response = httpclient.execute(httpget);
View Full Code Here

Examples of org.apache.http.params.BasicHttpParams

  @Test
  public void deleteTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpDelete httpdelete = new HttpDelete("http://localhost:" + PORT + "/delete");
    HttpResponse response = httpclient.execute(httpdelete);
View Full Code Here

Examples of org.apache.http.params.BasicHttpParams

  @Test
  public void PostTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpPost httppost = new HttpPost("http://localhost:" + PORT + "/post");
    HttpResponse response = httpclient.execute(httppost);
View Full Code Here
TOP
Copyright © 2015 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.