I am trying to connect to server via websockets.
I was able to reach it via postman, but getting server error each time trying to connect.
I would like to see a response from server. How can I do it?
how I establish connection
val options = IO.Options.builder()
.setAuth(
// singletonMap("Authorization", "Token 123") // tried this option as well
singletonMap("Token", "123")
).build()
private var mySocket: Socket = IO.socket("wss://api.myhost.com/v1/listen", options)
I have EVENT_CONNECT_ERROR handler:
socketDeepgram.on(Socket.EVENT_CONNECT_ERROR) {
it.forEach {
(it as EngineIOException).printStackTrace()
}
}
which gives me following trace:
2022-12-23 17:13:55.929 5613-11317/me.echoist.app W/System.err: io.socket.engineio.client.EngineIOException: server error
2022-12-23 17:13:55.930 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.client.Socket.onPacket(Socket.java:552)
2022-12-23 17:13:55.930 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.client.Socket.access$1000(Socket.java:29)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.client.Socket$5.call(Socket.java:335)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err: at io.socket.emitter.Emitter.emit(Emitter.java:117)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.client.Transport.onPacket(Transport.java:124)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.client.transports.Polling.access$700(Polling.java:17)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.client.transports.Polling$2.call(Polling.java:126)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.parser.Parser.decodePayload(Parser.java:127)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.client.transports.Polling._onData(Polling.java:131)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.client.transports.Polling.onData(Polling.java:101)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err: at io.socket.engineio.client.transports.PollingXHR$5$1.run(PollingXHR.java:115)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err: at io.socket.thread.EventThread$2.run(EventThread.java:80)
2022-12-23 17:13:55.933 5613-11317/me.echoist.app W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2022-12-23 17:13:55.933 5613-11317/me.echoist.app W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2022-12-23 17:13:55.933 5613-11317/me.echoist.app W/System.err: at java.lang.Thread.run(Thread.java:919)
socket client version:
io.socket:socket.io-client:2.1.0
I would like to know how to see a full response from ws server to troubleshoot (I was able to see clear error with postman)
Related
I have native executable on device at /data/local/tmp and using java api to run the exe java.runtime.exec() method. However, I get permission denied error:13(stacktrace attached below.)
String runexec= "/data/local/tmp/test";
Process p = Runtime.getRuntime().exec(runexec);
Java.io.IOException: Cannot run program "/data/local/tmp/test": error=13, Permission denied
W/System.err: at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
W/System.err: at java.lang.Runtime.exec(Runtime.java:692)
W/System.err: at java.lang.Runtime.exec(Runtime.java:525)
W/System.err: at java.lang.Runtime.exec(Runtime.java:422)
W/System.err: at android.view.View.performClick(View.java:6891)
W/System.err: at android.widget.TextView.performClick(TextView.java:12651)
W/System.err: at android.view.View$PerformClick.run(View.java:26083)
W/System.err: at android.os.Handler.handleCallback(Handler.java:789)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6938)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
W/System.err: Caused by: java.io.IOException: error=13, Permission denied
W/System.err: at java.lang.UNIXProcess.forkAndExec(Native Method)
W/System.err: at java.lang.UNIXProcess.<init>(UNIXProcess.java:133)
W/System.err: at java.lang.ProcessImpl.start(ProcessImpl.java:128)
W/System.err: at java.lang.ProcessBuilder.start(Pro
Edit: test exe has a+x or say 777 permission and functions properly via adb shell however, fails when invoked with java.
You are using Android OS. I had a similar problem on RHEL.
The secret was that SELINUX just LOVES to prevent stuff like this.
Check the log file /var/log/messages and search it for your executable name. You may find something similar to this:
"SELinux is preventing pool-2-thread-1 from execute access on the file <your_exec_here>"
I am trying to implement box-java-sdk with jwt authentication in android. When sdk is trying to decrypt private key in these lines:
InputDecryptorProvider pkcs8Prov = new JceOpenSSLPKCS8DecryptorProviderBuilder().setProvider("BC")
.build(this.privateKeyPassword.toCharArray());
PrivateKeyInfo keyInfo = ((PKCS8EncryptedPrivateKeyInfo) keyPair).decryptPrivateKeyInfo(pkcs8Prov);
decryptedPrivateKey = (new JcaPEMKeyConverter()).getPrivateKey(keyInfo);
following exception is occuring:
W/System.err: com.box.sdk.BoxAPIException: Error parsing PKCS private key for Box Developer Edition.
W/System.err: at com.box.sdk.BoxDeveloperEditionAPIConnection.decryptPrivateKey(BoxDeveloperEditionAPIConnection.java:516)
W/System.err: at com.box.sdk.BoxDeveloperEditionAPIConnection.constructJWTAssertion(BoxDeveloperEditionAPIConnection.java:450)
W/System.err: at com.box.sdk.BoxDeveloperEditionAPIConnection.constructJWTAssertion(BoxDeveloperEditionAPIConnection.java:431)
W/System.err: at com.box.sdk.BoxDeveloperEditionAPIConnection.authenticate(BoxDeveloperEditionAPIConnection.java:320)
W/System.err: at com.box.sdk.BoxDeveloperEditionAPIConnection.tryRestoreUsingAccessTokenCache(BoxDeveloperEditionAPIConnection.java:419)
W/System.err: at com.box.sdk.BoxDeveloperEditionAPIConnection.getAppUserConnection(BoxDeveloperEditionAPIConnection.java:271)
W/System.err: at com.box.sdk.BoxDeveloperEditionAPIConnection.getAppUserConnection(BoxDeveloperEditionAPIConnection.java:296)
W/System.err: at com.kapalya.box.BoxClient$1.inBackgroud(BoxClient.java:41)
W/System.err: at com.kapalya.box.BoxClient$4.doInBackground(BoxClient.java:111)
W/System.err: at com.kapalya.box.BoxClient$4.doInBackground(BoxClient.java:107)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:295)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
W/System.err: at java.lang.Thread.run(Thread.java:818)
W/System.err: Caused by: org.bouncycastle.pkcs.PKCSException: unable to read encrypted data: 1.2.840.113549.1.5.13 not available: Provider BC does not provide 1.2.840.113549.3.7
W/System.err: at org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo.decryptPrivateKeyInfo(Unknown Source)
W/System.err: at com.box.sdk.BoxDeveloperEditionAPIConnection.decryptPrivateKey(BoxDeveloperEditionAPIConnection.java:505)
W/System.err: ... 15 more
W/System.err: Caused by: org.bouncycastle.operator.OperatorCreationException: 1.2.840.113549.1.5.13 not available: Provider BC does not provide 1.2.840.113549.3.7
W/System.err: at org.bouncycastle.openssl.jcajce.JceOpenSSLPKCS8DecryptorProviderBuilder$1.get(Unknown Source)
W/System.err: ... 17 more
W/System.err: Caused by: java.security.NoSuchAlgorithmException: Provider BC does not provide 1.2.840.113549.3.7
W/System.err: at javax.crypto.Cipher.getCipher(Cipher.java:357)
W/System.err: at javax.crypto.Cipher.getInstance(Cipher.java:325)
W/System.err: at javax.crypto.Cipher.getInstance(Cipher.java:297)
W/System.err: at org.bouncycastle.jcajce.util.NamedJcaJceHelper.createCipher(Unknown Source)
W/System.err: ... 18 more
While this sdk is working fine in standard java app. Is there any change in android's implementation of BountyCastle provider ? Is there a workaround for this problem ?
Got it to work by first removing android implementation of BountyCastle :
Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
so the static block to register BouncyCastleProvider becomes:
static {
Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
Security.addProvider(new BouncyCastleProvider());
}
I am making an application that uses REST communication with a HTTP server running on the hosts laptop. The problem is that I can't use a URL with http://192.168.0.289:3000/api/poststuff. I get hostname lookup failure for 192.168.0.289. OkHttp refuses to get that that's an IP address and lookup can be bypassed. The error I get is,
W/System.err: java.net.UnknownHostException: Unable to resolve host "192.168.0.289": No address associated with hostname
W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:470)
W/System.err: at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
W/System.err: at java.net.InetAddress.getAllByName(InetAddress.java:215)
W/System.err: at okhttp3.Dns$1.lookup(Dns.java:39)
W/System.err: at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:170)
W/System.err: at okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.java:136)
W/System.err: at okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:81)
W/System.err: at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:181)
W/System.err: at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:132)
W/System.err: at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:101)
W/System.err: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
W/System.err: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
W/System.err: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
W/System.err: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
W/System.err: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:129)
W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
W/System.err: at java.lang.Thread.run(Thread.java:818)
W/System.err: Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
W/System.err: at libcore.io.Posix.android_getaddrinfo(Native Method)
W/System.err: at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
W/System.err: ... 26 more
Doesn't even work with HttpUrl
request = new Request.Builder()
.url( new HttpUrl.Builder()
.scheme("http")
.host("192.168.0.289")
.port(3000)
.addPathSegment(POSTURL)
.build())
.build();
Grade info
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.protobuf:protobuf-java:2.6.0'
compile 'com.squareup.okhttp3:okhttp:3.5.0'
How do I do this with OkHttp or some other library ?
I have two Fragment activities namely Feed and Profile.Both of these activities request some data from the server using a volley JSON request.I have also created a singleton class that encapsulates the Volley RequestQueue. Initially, both the activities load data properly using volley. However, after continuous switching between the activities Volley throws the following error and afterward no requests are sent to the server for some period.
1-12 14:48:58.146 27190-27190/com.tdn W/System.err: com.android.volley.NoConnectionError: java.io.IOException: unexpected end of stream on Connection{www.grabuk.com:80, proxy=DIRECT# hostAddress=43.255.154.57 cipherSuite=none protocol=http/1.1} (recycle count=0)
11-12 14:48:58.146 27190-27190/com.tdn W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:151)
11-12 14:48:58.146 27190-27190/com.tdn W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
11-12 14:48:58.146 27190-27190/com.tdn W/System.err: Caused by: java.io.IOException: unexpected end of stream on Connection{www.grabuk.com:80, proxy=DIRECT# hostAddress=43.255.154.57 cipherSuite=none protocol=http/1.1} (recycle count=0)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:258)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:104)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:1154)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:982)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:474)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:410)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:532)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:110)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: ... 1 more
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: Caused by: java.io.EOFException: \n not found: size=0 content=...
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:239)
11-12 14:48:58.151 27190-27190/com.tdn W/System.err: ... 9 more
11-12 14:48:58.156 27190-27190/com.tdn E/RecyclerView: No adapter attached; skipping layout
11-12 14:48:58.181 27190-27190/com.tdn D/error:: com.android.volley.NoConnectionError: java.io.IOException: unexpected end of stream on Connection{www.grabuk.com:80, proxy=DIRECT# hostAddress=43.255.154.57 cipherSuite=none protocol=http/1.1} (recycle count=0)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: com.android.volley.NoConnectionError: java.io.IOException: unexpected end of stream on Connection{www.grabuk.com:80, proxy=DIRECT# hostAddress=43.255.154.57 cipherSuite=none protocol=http/1.1} (recycle count=0)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:151)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: Caused by: java.io.IOException: unexpected end of stream on Connection{www.grabuk.com:80, proxy=DIRECT# hostAddress=43.255.154.57 cipherSuite=none protocol=http/1.1} (recycle count=0)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:258)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:104)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:1154)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:982)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:474)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:410)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:532)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:110)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: ... 1 more
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: Caused by: java.io.EOFException: \n not found: size=0 content=...
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:239)
11-12 14:48:58.181 27190-27190/com.tdn W/System.err: ... 9 more
After waiting some time when I again switch between the activities the volley loads the data properly. I read a lot of questions on StackOverflow but none of them seems to have solved my problem. This is what my volley request looks like:
{
Map<String, String> params = new HashMap<String, String>();
params.put(UID, String.valueOf(Singelton.getUserID()));
params.put(COUNT,Integer.toString(cnt));
RequestQueue requestQueue = CustomVolleyRequest.getInstance(getActivity().getApplicationContext()).getRequestQueue();
CustomRequest jsObjRequest = new CustomRequest(Request.Method.POST, url, params, new Response.Listener<JSONObject>()
{
#Override
public void onResponse(JSONObject response)
{
Log.d("respnse:",response.toString());
processresponse(response);
}
}, new Response.ErrorListener()
{
#Override
public void onErrorResponse(VolleyError error)
{
error.printStackTrace();
}
});
requestQueue.add(jsObjRequest);
}
I am trying to upload images in quickblox, i already did it once, but I receiving now this message of error.
My file for example is this one: "/data/user/0/dinidiniz.tradersmtg/app_Traders MTG Images/Sat Apr 30 20:58:36 GMT-03:00 2016.png". I tested, it exists and works just fine to get the bitmap.
When i upload using:
QBContent.uploadFileTask(imageFile, fileIsPublic, null, new QBEntityCallback<QBFile>()
I receive this error:
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: com.quickblox.core.exception.QBResponseException: File upload onError,Incorrect content type
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: at com.quickblox.content.task.TaskEntityUploadFile.performTask(TaskEntityUploadFile.java:74)
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: at com.quickblox.content.QBContent.uploadFileTask(QBContent.java:560)
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: at dinidiniz.tradersmtg.activities.ProfileEditActivity.changeAvatar(ProfileEditActivity.java:183)
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: at dinidiniz.tradersmtg.activities.ProfileEditActivity.onActivityResult(ProfileEditActivity.java:166)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.Activity.dispatchActivityResult(Activity.java:6442)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:3716)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:3763)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread.-wrap16(ActivityThread.java)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.os.Looper.loop(Looper.java:148)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5443)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at java.lang.reflect.Method.invoke(Native Method)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Needed to add "OutPutStream.flush();" after creating the image at the file that it started to have a content. I forgot this line.