0

I'm unable to create dynamic proxy for HttpURLConnection class, since it don't have public constructor to create Enhancer. Coming to requirement, I want to create a dynamic proxy to get details of current connection at run time.

I tried using this tutorial, but failed to do so.

Jyothi Babu Araja
  • 10,076
  • 3
  • 31
  • 38

1 Answers1

1

You can use a library like Objenesis to create instances of classes that do not offer a suitable constructor. You can use cglib for creating the subclass but without creating the instance in this case.

Rafael Winterhalter
  • 42,759
  • 13
  • 108
  • 192