Getting "Connection refused" error while trying to connect and empty the Amazon s3 bucket
<p>I have created one Amazon s3 bucket via api and I am able to upload file successfully. But while I am trying to empty the bucket with same credentials, I am getting  exception as "<em>com.amazonaws.http.AmazonHttpClient: Unable to execute HTTP request: Connection refused</em>".</p>

<p>My code snippet is like below..</p>

<pre><code>AWSCredentials awsCredentials =
            new BasicAWSCredentials(accessKey,secretKey);
    AmazonS3 s3client = new AmazonS3Client(awsCredentials);
    s3client.setEndpoint(endpoint);
</code></pre>

<p>Stack trace is </p>

<pre><code>INFO  [2016-04-22 14:50:52,885] com.amazonaws.http.AmazonHttpClient: Unable   to execute HTTP request: Connection refused
! java.net.ConnectException: Connection refused
! at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.7.0_79]
! atjava.net.AbstractPlainSocketImpl.doConnectna:1.7.0_79]   
! at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 
! at java.net.Socket.connect(Socket.java:579) ~[na:1.7.0_79]
! at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:625)    org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:409)com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.connectSocket(SdkTLSSocketFactory.java:134)
</code></pre>

<p>Not sure whether I am doing the right thing or is there any proxy issue.</p>