How can I instantiate Java object of type java.net.Proxy.Type (an Enum)

조회 수: 5 (최근 30일)
Jan
Jan 2014년 4월 2일
답변: Mohammad Sami 2015년 1월 7일
Unfortuantely, when trying to use the Java Proxy class, I cannot create the enum for the Proxy Type. I always get sometime like
Might it be related to that it is an encapsulated class ? Thanks for any help on that.

답변 (1개)

Mohammad Sami
Mohammad Sami 2015년 1월 7일
Hi,
You can use the following code to instantiate the Proxy.
socket = java.net.InetSocketAddress('proxy_addr', proxy_port);
proxy_http = javaMethod('valueOf','java.net.Proxy$Type','HTTP');
proxy = java.net.Proxy(proxy_http, socket);
Hope it helps :)

카테고리

Help CenterFile Exchange에서 Java Package Integration에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by