title: ParseObject.saveInBackground method ending with java.net.SocketTimeoutException: null while saving data to Parse.com
body: <p>I checked the past posts about the same issue (<a href="https://stackoverflow.com/questions/24897231/saveinbackground-callback-doesnt-work">saveinbackground-doesnt-work</a>). </p>
  
  <p>I am trying to get the following code working with Parse.com:</p>
  
  <pre><code>sendMessage.saveInBackground(new SaveCallback() {
          @Override
          public void done(ParseException e) {
              setProgressBarIndeterminateVisibility(false);
              Log.d("Error","Completed Done");
              if (e==null){
                  Toast.makeText(RecipientsActivity.this,"Message Sent!",Toast.LENGTH_LONG).show();
              } else {
                  Log.d("TAG",e.getMessage());
                  Log.d("TAG",e.getCode() + "error code");
  
              }
          }
      });
  
  }
  </code></pre>
  
  <p>This saveinBackground method is taking too long to execute and when it does, it ends with giving the following error:
  i/o failure: java.net.SocketTimeoutException: null
  100error code</p>
  
  <p>I am using Parse in other pieces of the application too wherein I am fetching user contact from the Parse Core.</p>
  
  <p>The message is the new class which is used to post pictures &amp; video's on parse.com I am using the following code to create the ParseObject:</p>
  
  <pre><code>protected ParseObject createMessage(){
  ParseObject message = new ParseObject(ParseConstants.CLASS_MESSAGES);
      message.put(ParseConstants.KEY_SENDER_ID,ParseUser.getCurrentUser().getObjectId());
      message.put(ParseConstants.KEY_SENDER_NAME,ParseUser.getCurrentUser().getUsername());
      message.put(ParseConstants.KEY_RECIPIENTS_ID,getRecipientsIDs());
      message.put(ParseConstants.KEY_FILE_TYPE,fileType);
      //Log.d("TAG1","Message: " + message);
      //Log.d("TAG1",mediaUri + "");
  
      byte[] fileBytes = FileHelper.getByteArrayFromFile(this,mediaUri);
  
      if (fileBytes==null) return null;
      else {
              if (fileType.equals(ParseConstants.FILE_TYPE_IMAGE)){
              fileBytes = FileHelper.reduceImageForUpload(fileBytes);
  
       }
          String fileName = FileHelper.getFileName(this,mediaUri,fileType);
          ParseFile parseFile = new ParseFile(fileName,fileBytes);
          message.put(ParseConstants.KEY_FILE,parseFile);
         // Log.d("TAG2","Message: " + fileType);
         // Log.d("TAG2",mediaUri + "");
          return message;
      }
  }
  </code></pre>
  
  <p>I checked the logs and found that the message is getting correctly created. Moreover I checked on Parse.com to see if any message class has been created there but none is being shown. </p>
  
  <p>The error i am getting is this :</p>
  
  <pre><code>10-25 19:23:08.695  11405-11405 W/System.err﹕ com.parse.ParseException: Upload to S3 failed. Bad Request
  10-25 19:23:08.695  11405-11405 W/System.err﹕ at com.parse.ParseAWSRequest.onResponse(ParseAWSRequest.java:94)
  10-25 19:23:08.695  11405-11405/ W/System.err﹕ at com.parse.ParseAWSRequest.onResponse(ParseAWSRequest.java:28)
  10-25 19:23:08.695  11405-11405/ W/System.err﹕ at com.parse.ParseRequest$3.call(ParseRequest.java:267)
  10-25 19:23:08.695  11405-11405/ W/System.err﹕ at com.parse.Task$3.run(Task.java:199)
  10-25 19:23:08.695  11405-11405/ W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
  10-25 19:23:08.695  11405-11405/ W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  10-25 19:23:08.695  11405-11405/ W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
  </code></pre>
  
  <p>After trying to debug the error, I found that if I remove the code to attach the image, it works fine. So i tried various methods to convert image to Byte[] including <a href="https://stackoverflow.com/questions/10296734/image-uri-to-bytesarray">image uri to byte array</a> and <a href="https://stackoverflow.com/questions/24072816/saving-and-retreving-photos-and-videos-in-parse-android">saving files to parse</a> but still i m not finding any luck</p>