Package com.mongodb

Class MongoSocksProxyException

All Implemented Interfaces:
Serializable

public class MongoSocksProxyException extends MongoSocketOpenException
Thrown when an error occurs while connecting via a SOCKS5 proxy.

getProxyReplyCode() returns the RFC 1928 reply code sent by the proxy when a non-success CONNECT reply was successfully parsed; it returns null otherwise (including for any failure that did not produce a parsed CONNECT reply, e.g. proxy TCP connect failure, negotiation failure, authentication failure, failure connecting through the proxy to the target server that did not yield a parsed reply, or an I/O error mid-CONNECT).

RFC 1928 reply codes: 1=general failure, 2=connection not allowed by ruleset, 3=network unreachable, 4=host unreachable, 5=connection refused, 6=TTL expired, 7=command not supported, 8=address type not supported.

Since:
5.12
  • Constructor Details

    • MongoSocksProxyException

      public MongoSocksProxyException(String message, ServerAddress serverAddress)
      Construct an instance with no cause and no RFC 1928 reply code.
      Parameters:
      message - the message
      serverAddress - the server address
    • MongoSocksProxyException

      public MongoSocksProxyException(String message, ServerAddress serverAddress, Throwable cause)
      Construct an instance with a cause and no RFC 1928 reply code.
      Parameters:
      message - the message
      serverAddress - the server address
      cause - the cause
    • MongoSocksProxyException

      public MongoSocksProxyException(String message, ServerAddress serverAddress, @Nullable Integer proxyReplyCode)
      Construct an instance with no cause and an RFC 1928 reply code from a parsed non-success CONNECT reply.
      Parameters:
      message - the message
      serverAddress - the server address
      proxyReplyCode - the RFC 1928 reply code, or null
    • MongoSocksProxyException

      public MongoSocksProxyException(String message, ServerAddress serverAddress, @Nullable Throwable cause, @Nullable Integer proxyReplyCode)
      Construct an instance with a cause and an optional RFC 1928 reply code.
      Parameters:
      message - the message
      serverAddress - the server address
      cause - the cause, may be null
      proxyReplyCode - the RFC 1928 reply code, or null
  • Method Details

    • getProxyReplyCode

      @Nullable public Integer getProxyReplyCode()
      Returns the RFC 1928 reply code sent by the SOCKS5 proxy when a non-success CONNECT reply was successfully parsed, or null otherwise.
      Returns:
      the RFC 1928 proxy reply code, or null