Is it possible to set pointcut on native method call with AspectJ? I tried following aspect:
public aspect EmailAspect {
pointcut conn() : call(* java.net.PlainSocketImpl.socketConnect(..));
before() : conn() {
System.out.println("Connecting");
}
}
But it doesn't work. I also didn't find much relevant info via googling (except this http://blog.jayway.com/2007/02/16/static-mock-using-aspectj, however it's not clear if it's possible & how to do it).
I tried to debug my test code (which only connects to some TCP localhost port) in Eclipse and eclipse stopped at socketConnect() breakpoint.
Thank you.
UPDATE
This is probably the cause:
AspectJ - Load-time weaving, privileged aspect and pointcut on private method of JRE class