title: Applet: SocketException Unknown proxy type : HTTP
body: <p>I have no problems running my applet in Eclipse, but if I sign and run it in browser this happend</p>
  
  <pre><code>10-abr-2013 19:54:37 org.apache.http.impl.client.DefaultHttpClient tryConnect
  INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Unknown proxy type : HTTP
  10-abr-2013 19:54:37 org.apache.http.impl.client.DefaultHttpClient tryConnect
  INFO: Retrying connect
  …
  java.net.SocketException: Unknown proxy type : HTTP
      at java.net.SocksSocketImpl.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source) 
  </code></pre>
  
  <p>Here im trying  to upload some files using org.apache.http.client.HttpClient</p>
  
  <pre><code>public static String executeMultiPartRequest(String urlString, File file,
          String fileName, String fileDescription) {
  
      System.out.println("SET URI " + urlString);
      HttpPost postRequest = new HttpPost(urlString);
      try {
  
          MultipartEntity multiPartEntity = new MultipartEntity();
  
          // The usual form parameters can be added this way
          multiPartEntity.addPart("fileDescription", new StringBody(
                  fileDescription != null ? fileDescription : ""));
          multiPartEntity.addPart("fileName", new StringBody(
                  fileName != null ? fileName : file.getName()));
  
          /*
           * Need to construct a FileBody with the file that needs to be
           * attached and specify the mime type of the file. Add the fileBody
           * to the request as an another part. This part will be considered
           * as file part and the rest of them as usual form-data parts
           */
          FileBody fileBody = new FileBody(file, "application/octect-stream");
          multiPartEntity.addPart("attachment", fileBody);
  
          // multiPartEntity.addPart("path", Charset.forName("UTF-8"));
  
          postRequest.setEntity(multiPartEntity);
      } catch (UnsupportedEncodingException ex) {
          ex.printStackTrace();
      }
  
      return executeRequest(postRequest);
  }
  
  private static String executeRequest(HttpRequestBase requestBase) {
      String responseString = "";
  
      InputStream responseStream = null;
      HttpClient client = new DefaultHttpClient();
      try {
          System.out.println("LISTO PARA ENVIAR A" + requestBase.getURI());
          HttpResponse response = client.execute(requestBase);
          if (response != null) {
              HttpEntity responseEntity = response.getEntity();
  
              if (responseEntity != null) {
                  responseStream = responseEntity.getContent();
                  if (responseStream != null) {
                      BufferedReader br = new BufferedReader(
                              new InputStreamReader(responseStream));
                      String responseLine = br.readLine();
                      String tempResponseString = "";
                      while (responseLine != null) {
                          tempResponseString = tempResponseString
                                  + responseLine
                                  + System.getProperty("line.separator");
                          responseLine = br.readLine();
                      }
                      br.close();
                      if (tempResponseString.length() &gt; 0) {
                          responseString = tempResponseString;
                      }
                  }
              }
          }
      } catch (UnsupportedEncodingException e) {
          e.printStackTrace();
      } catch (ClientProtocolException e) {
          e.printStackTrace();
      } catch (IllegalStateException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      } finally {
          if (responseStream != null) {
              try {
                  responseStream.close();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
      }
      client.getConnectionManager().shutdown();
  
      return responseString;
  }
  </code></pre>
  
  <p>What its wrong?</p>
  
  <p>Applet is signed and compiled with java 1.6, httpclient-4.1.3.jar</p>