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.
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.