Silvertunnel Netlib ( https://silvertunnel.org/doc/netlib.html ) を使用して、Tor ネットワーク経由で Java アプリケーション内から匿名化された HTTP リクエストを作成しようとしています。サンプルコードを使用しています。これは、TCPIP 経由でリクエストを行うときに機能しますが、TOR 設定を使用すると、次の例外で終了します (接続を試みてから約 10 分後)。
java.io.IOException: Tor.connect: unable to connect to null:80 after 11 full retries with 5 sub retries
at org.silvertunnel.netlib.layer.tor.clientimpl.Tor.connect(Tor.java:281)
at org.silvertunnel.netlib.layer.tor.TorNetLayer.createNetSocket(TorNetLayer.java:113)
at org.silvertunnel.netlib.util.HttpUtil.get(HttpUtil.java:121)
at FlightBot.main(FlightBot.java:48)
私が使用しているコードは次のとおりです。
NetLayer lowerNetLayer = NetFactory.getInstance().getNetLayerById(NetLayerIDs.TOR);
// wait until TOR is ready (optional) - this is only relevant for anonymous communication:
lowerNetLayer.waitUntilReady();
// prepare parameters (http default port: 80)
TcpipNetAddress httpServerNetAddress = new TcpipNetAddress("httptest.silvertunnel.org", 80);
String pathOnHttpServer = "/httptest/bigtest.jsp?id=example";
long timeoutInMs = 5000;
// do the HTTP request and wait for the response
byte[] responseBody = HttpUtil.getInstance().get(lowerNetLayer, httpServerNetAddress, pathOnHttpServer, timeoutInMs);
// print out the response
System.out.println(new String(responseBody));
何か間違ったことをしているのですか、それとも Tor ネットワークが現在利用できないのですか?
明確にするために、次を使用すると機能します。
NetLayer lowerNetLayer = NetFactory.getInstance().getNetLayerById(NetLayerIDs.TCPIP)
最初の行に。