Android Open Source - Orlib Socks Exception






From Project

Back to project page Orlib.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project Orlib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.sourceforge.jsocks.socks;
/*from w ww .j  a  v a  2 s.  co  m*/
/**
 Exception thrown by various socks classes to indicate errors
 with protocol or unsuccessful server responses.
*/
public class SocksException extends java.io.IOException{
   /**
    Construct a SocksException with given error code.
    <p>
    Tries to look up message which corresponds to this error code.
    @param errCode Error code for this exception.
   */
   public SocksException(int errCode){
       this.errCode = errCode;
       if((errCode >> 16) == 0){
          //Server reply error message
          errString = errCode <= serverReplyMessage.length ?
                      serverReplyMessage[errCode] :
                      UNASSIGNED_ERROR_MESSAGE;
       }else{
          //Local error
          errCode = (errCode >> 16) -1;
          errString = errCode <= localErrorMessage.length ?
                      localErrorMessage[errCode] :
                      UNASSIGNED_ERROR_MESSAGE;
       }
   }
   /**
    Constructs a SocksException with given error code and message.
    @param errCode  Error code.
    @param errString Error Message.
   */
   public SocksException(int errCode,String errString){
       this.errCode = errCode;
       this.errString = errString;
   }
   /**
    Get the error code associated with this exception.
    @return Error code associated with this exception.
   */
   public int getErrorCode(){
      return errCode;
   }
   /**
    Get human readable representation of this exception.
    @return String represntation of this exception.
   */
   public String toString(){
      return errString;
   }

   static final String UNASSIGNED_ERROR_MESSAGE =
                  "Unknown error message";
   static final String serverReplyMessage[] = { 
                  "Succeeded", 
                  "General SOCKS server failure",
                  "Connection not allowed by ruleset",
                  "Network unreachable",
                  "Host unreachable",
                  "Connection refused",
                  "TTL expired",
                  "Command not supported",
                  "Address type not supported" };

   static final String localErrorMessage[] ={
                  "SOCKS server not specified",
                  "Unable to contact SOCKS server",
                  "IO error",
                  "None of Authentication methods are supported",
                  "Authentication failed",
                  "General SOCKS fault" };

   String errString;
   int errCode;

}//End of SocksException class





Java Source Code List

info.guardianproject.net.SocksSocketFactory.java
info.guardianproject.net.http.HttpManager.java
info.guardianproject.net.http.ModSSLSocketFactory.java
info.guardianproject.net.http.MyDefaultClientConnectionOperator.java
info.guardianproject.net.http.MyThreadSafeClientConnManager.java
info.guardianproject.net.http.SocksHttpClient.java
net.sourceforge.jsocks.SOCKS.java
net.sourceforge.jsocks.SocksServerException.java
net.sourceforge.jsocks.socks.AuthenticationException.java
net.sourceforge.jsocks.socks.AuthenticationNone.java
net.sourceforge.jsocks.socks.Authentication.java
net.sourceforge.jsocks.socks.InetRange.java
net.sourceforge.jsocks.socks.ProxyMessage.java
net.sourceforge.jsocks.socks.ProxyServer.java
net.sourceforge.jsocks.socks.Proxy.java
net.sourceforge.jsocks.socks.Socks4Message.java
net.sourceforge.jsocks.socks.Socks4Proxy.java
net.sourceforge.jsocks.socks.Socks5DatagramSocket.java
net.sourceforge.jsocks.socks.Socks5Message.java
net.sourceforge.jsocks.socks.Socks5Proxy.java
net.sourceforge.jsocks.socks.SocksException.java
net.sourceforge.jsocks.socks.SocksServerSocket.java
net.sourceforge.jsocks.socks.SocksSocket.java
net.sourceforge.jsocks.socks.UDPEncapsulation.java
net.sourceforge.jsocks.socks.UDPRelayServer.java
net.sourceforge.jsocks.socks.UserPasswordAuthentication.java
net.sourceforge.jsocks.socks.server.IdentAuthenticator.java
net.sourceforge.jsocks.socks.server.Ident.java
net.sourceforge.jsocks.socks.server.ServerAuthenticatorNone.java
net.sourceforge.jsocks.socks.server.ServerAuthenticator.java
net.sourceforge.jsocks.socks.server.UserPasswordAuthenticator.java
net.sourceforge.jsocks.socks.server.UserValidation.java
orlib.sample.OrlibMainActivity.java