How can I instantiate Java object of type java.net.Proxy.Type (an Enum)
3 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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);
Reference http://stackoverflow.com/questions/1223795/using-java-enums-or-public-static-fields-in-matlab
Hope it helps :)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Java Package Integration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!