synchronized void freeze() {
        if (frozen) {
            return;
        }
        if (userAgent == null) {
            setDefaultUserAgent();
        }
        serviceMap = new HashMap<String, ServiceEndpoint>();
        if (log.isDebugEnabled()) {
            StringBuilder buf = new StringBuilder();
            buf.append("Creating MwsConnection {");
            buf.append("applicationName:");
            buf.append(applicationName);
            buf.append(",applicationVersion:");
            buf.append(applicationVersion);
            buf.append(",awsAccessKeyId:");
            buf.append(awsAccessKeyId);
            buf.append(",uri:");
            buf.append(endpoint.toString());
            buf.append(",userAgent:");
            buf.append(userAgent);
            buf.append(",connectionTimeout:");
            buf.append(connectionTimeout);
            if (proxyHost != null && proxyPort != 0) {
                buf.append(",proxyUsername:");
                buf.append(proxyUsername);
                buf.append(",proxyHost:");
                buf.append(proxyHost);
                buf.append(",proxyPort:");
                buf.append(proxyPort);
            }
            buf.append("}");
            log.debug(buf);
        }

        BasicHttpParams httpParams = new BasicHttpParams();
        httpParams.setParameter(CoreProtocolPNames.USER_AGENT, userAgent);
        HttpConnectionParams
                .setConnectionTimeout(httpParams, connectionTimeout);
        HttpConnectionParams.setSoTimeout(httpParams, socketTimeout);
        HttpConnectionParams.setStaleCheckingEnabled(httpParams, true);
        HttpConnectionParams.setTcpNoDelay(httpParams, true);

        connectionManager = getConnectionManager();
        httpClient = new DefaultHttpClient(connectionManager, httpParams);
        httpContext = new BasicHttpContext();
        if (proxyHost != null && proxyPort != 0) {
            String scheme = MwsUtl.usesHttps(endpoint) ? "https" : "http";
            HttpHost hostConfiguration = new HttpHost(proxyHost, proxyPort, scheme);
            httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, hostConfiguration);

            if (proxyUsername != null && proxyPassword != null) {
                Credentials credentials = new UsernamePasswordCredentials(proxyUsername, proxyPassword);
                CredentialsProvider cprovider = new BasicCredentialsProvider();
                cprovider.setCredentials(new AuthScope(proxyHost, proxyPort), credentials);
                httpContext.setAttribute(ClientContext.CREDS_PROVIDER, cprovider);
            }
        }
        headers = Collections.unmodifiableMap(headers);
        frozen = true;
    }
synchronized void freeze ( ) { if ( frozen ) { return ; } if ( userAgent == null ) { setDefaultUserAgent ( ) ; } serviceMap = new HashMap < String , ServiceEndpoint > ( ) ; if ( log . isDebugEnabled ( ) ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "Creating MwsConnection {" ) ; buf . append ( "applicationName:" ) ; buf . append ( applicationName ) ; buf . append ( ",applicationVersion:" ) ; buf . append ( applicationVersion ) ; buf . append ( ",awsAccessKeyId:" ) ; buf . append ( awsAccessKeyId ) ; buf . append ( ",uri:" ) ; buf . append ( endpoint . toString ( ) ) ; buf . append ( ",userAgent:" ) ; buf . append ( userAgent ) ; buf . append ( ",connectionTimeout:" ) ; buf . append ( connectionTimeout ) ; if ( proxyHost != null && proxyPort != 0 ) { buf . append ( ",proxyUsername:" ) ; buf . append ( proxyUsername ) ; buf . append ( ",proxyHost:" ) ; buf . append ( proxyHost ) ; buf . append ( ",proxyPort:" ) ; buf . append ( proxyPort ) ; } buf . append ( "}" ) ; log . debug ( buf ) ; } BasicHttpParams httpParams = new BasicHttpParams ( ) ; httpParams . setParameter ( CoreProtocolPNames . USER_AGENT , userAgent ) ; HttpConnectionParams . setConnectionTimeout ( httpParams , connectionTimeout ) ; HttpConnectionParams . setSoTimeout ( httpParams , socketTimeout ) ; HttpConnectionParams . setStaleCheckingEnabled ( httpParams , true ) ; HttpConnectionParams . setTcpNoDelay ( httpParams , true ) ; connectionManager = getConnectionManager ( ) ; httpClient = new DefaultHttpClient ( connectionManager , httpParams ) ; httpContext = new BasicHttpContext ( ) ; if ( proxyHost != null && proxyPort != 0 ) { String scheme = MwsUtl . usesHttps ( endpoint ) ? "https" : "http" ; HttpHost hostConfiguration = new HttpHost ( proxyHost , proxyPort , scheme ) ; httpClient . getParams ( ) . setParameter ( ConnRoutePNames . DEFAULT_PROXY , hostConfiguration ) ; if ( proxyUsername != null && proxyPassword != null ) { Credentials credentials = new UsernamePasswordCredentials ( proxyUsername , proxyPassword ) ; CredentialsProvider cprovider = new BasicCredentialsProvider ( ) ; cprovider . setCredentials ( new AuthScope ( proxyHost , proxyPort ) , credentials ) ; httpContext . setAttribute ( ClientContext . CREDS_PROVIDER , cprovider ) ; } } headers = Collections . unmodifiableMap ( headers ) ; frozen = true ; }
Initialize the connection.