1
我使用AWS Java SDK for SQS閱讀從本地隊列中的消息。我爲本地隊列使用ElasticMQ。
@Test
public void readMessageFromQueue() {
AWSCredentialsProviderChain credentialsProvider = new AWSCredentialsProviderChain(new DefaultAWSCredentialsProviderChain());
ClientConfiguration clientConfiguration = new ClientConfiguration();
AmazonSQSClient sqsClient = new AmazonSQSClient(credentialsProvider, clientConfiguration);
sqsClient.setEndpoint("http://127.0.0.1:9324/queue");
ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest("queue1").withMaxNumberOfMessages(10);
ReceiveMessageResult receiveMessageResult = sqsClient.receiveMessage(receiveMessageRequest);
List<Message> sqsMessages = receiveMessageResult.getMessages();
}
這工作完全直到我通過代理服務器(工作)
然後我得到了504
,因爲它試圖通過我的代理路線我的本地主機連接到我的互聯網。
問題
如何繞過我的代理我用Java編程本地主機?
我曾嘗試以下無濟於事
System.setProperty("NO_PROXY", "127.0.0.1");
System.setProperty("proxySet", "false");
System.setProperty("proxyHost", "");
System.setProperty("proxyPort", "");
System.setProperty("no_proxy", "127.0.0.1");
System.setProperty("http.no_proxy", "127.0.0.1");
System.setProperty("http.proxySet", "false");
的作品是增加127.0.0.1
繞過蘋果機網絡設置代理的唯一的事情。
我自己也嘗試localhost
(反對127.0.0.1
)
什麼想法?