Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HostConfiguration


    {
        new DifferentProtocolTemplate()
        {
            protected void doTest() throws Exception
            {
                HostConfiguration hostConfig = createHostConfiguration();

                Protocol protocol = Protocol.getProtocol("httpx");
                hostConfig.setHost("www.mulesoft.org", "www.mulesoft.com", 8080, protocol);
               
                assertDefaultSocketFactory(hostConfig);
                assertEquals("www.mulesoft.org", hostConfig.getHost());
                assertEquals(8080, hostConfig.getPort());
                assertEquals("www.mulesoft.com", hostConfig.getVirtualHost());
            }
        }.test();
    }
View Full Code Here


        }.test();
    }

    public void testSetHostViaHostAndPort()
    {
        HostConfiguration hostConfig = createHostConfiguration();

        hostConfig.setHost("www.mulesoft.org", 8080);

        assertMockSocketFactory(hostConfig);
        assertEquals("www.mulesoft.org", hostConfig.getHost());
        assertEquals(8080, hostConfig.getPort());
    }
View Full Code Here

        assertEquals(8080, hostConfig.getPort());
    }

    public void testSetHostViaHost()
    {
        HostConfiguration hostConfig = createHostConfiguration();
       
        hostConfig.setHost("www.mulesoft.org");
       
        assertEquals("www.mulesoft.org", hostConfig.getHost());
        assertMockSocketFactory(hostConfig);
    }
View Full Code Here

        assertMockSocketFactory(hostConfig);
    }

    public void testClone()
    {
        HostConfiguration hostConfig = createHostConfiguration();
        HostConfiguration clone = (HostConfiguration) hostConfig.clone();
        assertMockSocketFactory(clone);
    }
View Full Code Here

        String requestXML = getServerUpdateRequest();
        // Send the request to the server
        HttpClient httpClient = new HttpClient();
        // Check if a proxy should be used
        if (isUsingProxy()) {
            HostConfiguration hc = new HostConfiguration();
            hc.setProxy(getProxyHost(), getProxyPort());
            httpClient.setHostConfiguration(hc);
        }
        PostMethod postMethod = new PostMethod(updateServiceURL);
        NameValuePair[] data = {
                new NameValuePair("type", "update"),
View Full Code Here

        String requestXML = getAvailablePluginsUpdateRequest();
        // Send the request to the server
        HttpClient httpClient = new HttpClient();
        // Check if a proxy should be used
        if (isUsingProxy()) {
            HostConfiguration hc = new HostConfiguration();
            hc.setProxy(getProxyHost(), getProxyPort());
            httpClient.setHostConfiguration(hc);
        }
        PostMethod postMethod = new PostMethod(updateServiceURL);
        NameValuePair[] data = {
                new NameValuePair("type", "available"),
View Full Code Here

        boolean installed = false;
        // Download and install new version of plugin
        HttpClient httpClient = new HttpClient();
        // Check if a proxy should be used
        if (isUsingProxy()) {
            HostConfiguration hc = new HostConfiguration();
            hc.setProxy(getProxyHost(), getProxyPort());
            httpClient.setHostConfiguration(hc);
        }
        GetMethod getMethod = new GetMethod(url);
        //execute the method
        try {
View Full Code Here

   * @return a new HostConfiguration
   */
  private HostConfiguration configurationForConnection( HttpConnection conn )
  {

    HostConfiguration connectionConfiguration = new SoapUIHostConfiguration();

    connectionConfiguration.setHost( conn.getHost(), conn.getPort(), conn.getProtocol() );
    if( conn.getLocalAddress() != null )
    {
      connectionConfiguration.setLocalAddress( conn.getLocalAddress() );
    }
    if( conn.getProxyHost() != null )
    {
      connectionConfiguration.setProxy( conn.getProxyHost(), conn.getProxyPort() );
    }

    if( conn.getParams().getParameter( SoapUIHostConfiguration.SOAPUI_SSL_CONFIG ) != null )
      connectionConfiguration.getParams().setParameter( SoapUIHostConfiguration.SOAPUI_SSL_CONFIG,
          conn.getParams().getParameter( SoapUIHostConfiguration.SOAPUI_SSL_CONFIG ) );

    return connectionConfiguration;
  }
View Full Code Here

     *           The connection to delete
     */
    private synchronized void deleteConnection( HttpConnection connection )
    {

      HostConfiguration connectionConfiguration = configurationForConnection( connection );

      if( LOG.isDebugEnabled() )
      {
        LOG.debug( "Reclaiming connection, hostConfig=" + connectionConfiguration );
      }
View Full Code Here

     *           a connection that is no longer being used
     */
    public void freeConnection( HttpConnection conn )
    {

      HostConfiguration connectionConfiguration = configurationForConnection( conn );

      if( LOG.isDebugEnabled() )
      {
        LOG.debug( "Freeing connection, hostConfig=" + connectionConfiguration );
      }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.HostConfiguration

Copyright © 2018 www.massapicom. 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.