get exception "java.io.IOException: read failed: EBADF" when getInputStream

this should solve the problem of exception "java.io.IOException: read failed: EBADF" when invoke getInputStream