Q:

OKHTTP : how to catch the EBADF exception

Using OkHTTP in my Android app, I have a lot of exception :
EX: 
java.lang. AssertionError: libcore.io. ErrnoException: getsockname failed: EBADF (Bad file number)
       at libcore.io. IoBridge.getSocketLocalPort(IoBridge.java:649)
       at libcore.io. IoBridge.closeSocket(IoBridge.java:202)
       at java.net. PlainSocketImpl.close(PlainSocketImpl.java:162)
       at ...
Caused by: libcore.io. ErrnoException: getsockname failed: EBADF (Bad file number)
       at libcore.io. Posix.getsockname(Posix.java)
       at libcore.io. ForwardingOs.getsockname(ForwardingOs.java:69)
       at libcore.io. IoBridge.getSocketLocalPort(IoBridge.java:645)
       at libcore.io. IoBridge.closeSocket(IoBridge.java:202)
       at java.net. PlainSocketImpl.close(PlainSocketImpl.java:162)
       at java.net. Socket.close(Socket.java:319)
       at ...

I can't catch this error because it's inside the OkHTTP library.  
Any solution for me ? 
Thanks

A:

I finally discuss with the OkHttp Team, And now the fix is inside the current release ! 
OkHttp v2.5.0
OkIO v1.6.0
More information here : 
https://github.com/square/okhttp/pull/1817
Root cause is a android 4 bug :
https://code.google.com/p/android/issues/detail?id=54072

