2013-08-30 2 views
2

hbc-twitter4j-v3를 통해 트윗 잡으려고합니다. 예제 코드 : https://github.com/twitter/hbc/blob/master/hbc-example/src/main/java/com/twitter/hbc/example/Twitter4jSampleStreamExample.java 프록시 인증을 위해 호스트, 포트 및 인증에 대한 시스템 속성도 설정했습니다. 하지만 다음과 같은 오류가 표시됩니다.twitter hosebird client가 작동하지 않습니다.

 
[main] INFO com.twitter.hbc.httpclient.BasicClient - New connection executed: hosebird-client-0, endpoint: /1.1/statuses/sample.json?delimited=length&stall_warnings=true 
[hosebird-client-io-thread-0] INFO com.twitter.hbc.httpclient.ClientBase - hosebird-client-0 Establishing a connection 
[main] INFO com.twitter.hbc.httpclient.BasicClient - Stopping the client: hosebird-client-0, endpoint: /1.1/statuses/sample.json?delimited=length&stall_warnings=true 
[main] INFO com.twitter.hbc.httpclient.ClientBase - hosebird-client-0 exit event - Stopped by user: waiting for 5000 ms 
[main] WARN com.twitter.hbc.httpclient.ClientBase - hosebird-client-0 Client thread failed to finish in 5000 millis 
[main] INFO com.twitter.hbc.httpclient.BasicClient - Successfully stopped the client: hosebird-client-0, endpoint: /1.1/statuses/sample.json?delimited=length&stall_warnings=true 
[hosebird-client-io-thread-0] WARN com.twitter.hbc.httpclient.ClientBase - hosebird-client-0 Unknown host - stream.twitter.com 
[hosebird-client-io-thread-0] WARN com.twitter.hbc.httpclient.ClientBase - hosebird-client-0 failed to establish connection properly 
[hosebird-client-io-thread-0] INFO com.twitter.hbc.httpclient.ClientBase - hosebird-client-0 Done processing, preparing to close connection 
[hosebird-client-io-thread-0] INFO com.twitter.hbc.httpclient.ClientBase - hosebird-client-0 Shutting down httpclient connection manager 

도움말이 있습니까? 속성을 설정하여 사용자가 http.proxy* 사람을 의미하는 경우

, 나는 그것이 hosebird으로 작동합니다 생각하지 않습니다 ... 미리 덕분에

답변

0

는 다행스럽게도 필자는 뭔가를 간과하지 않은하지만 그것이 나에게 표시하는 방법입니다 -client는 Apache를 사용하지 않는 Apache의 HTTP 클라이언트를 사용합니다.

구체적으로 코드 ClientBuilder 주위에서 hbc가 프록시 구성을 지원하지 않는 것처럼 보입니다. 아마도 그들은 기능 자체가 필요하지 않거나 필요하지 않은 좋은 이유가있을 것입니다. 요청할 수도 있습니다. ?

프록시를 사용하는 HttpClient을 얻을 수있는 방법 중 하나는 예를 들어, adding it to the HttpParams object입니다 것 같습니다 다음 HttpParams 객체가 어디 노출되지 동안

HttpParams params = ... 
HttpHost proxy = new HttpHost(hostname, port); 
params.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); 

당신이 잠재적하기 위해 ClientBuilder을 확장 할 수 프록시 구성을 제공하십시오. ClientBuilder#build() 메서드를 보면 HttpParams 개체가 설정된 위치를 알 수 있습니다. 행운을 빕니다!

편집 : 또한 issue은 hbc에서 직접 프록시 지원을 추가 할 계획이 없음을 나타냅니다.

관련 문제