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

4 visualizaciones (últimos 30 días)
Jan
Jan el 2 de Abr. de 2014
Respondida: Mohammad Sami el 7 de En. de 2015
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.

Respuestas (1)

Mohammad Sami
Mohammad Sami el 7 de En. de 2015
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 :)

Categorías

Más información sobre Java Package Integration en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by