/** * Returns a hexadecimal representation of the given byte array. * * @param bytes the array to output to an hex string * @return the hex representation as a string */ public static String asHex(byte[] bytes) { return asHex(bytes, null); }
/** * Returns a hexadecimal representation of the given byte array. * * @param bytes the array to output to an hex string * @return the hex representation as a string */ public static String asHex(byte[] bytes) { return asHex(bytes, null); }
/** * Returns a hexadecimal representation of the given byte array. * * @param bytes the array to output to an hex string * @return the hex representation as a string */ public static String asHex(byte[] bytes) { return asHex(bytes, null); }
sb.append(ByteUtilities.asHex(prehA1)); sb.append(':').append( StringUtilities.stringTo8859_1(StringUtilities.getDirectiveValue(map, "nonce", true))); sb.append(ByteUtilities.asHex(hA1)); sb.append(':').append(StringUtilities.getDirectiveValue(map, "nonce", true)); sb.append(":00000001:"); sb.append(ByteUtilities.asHex(hA2)); return ByteUtilities.asHex(hFinal);
sb.append(ByteUtilities.asHex(prehA1)); sb.append(':').append( StringUtilities.stringTo8859_1(StringUtilities.getDirectiveValue(map, "nonce", true))); sb.append(ByteUtilities.asHex(hA1)); sb.append(':').append(StringUtilities.getDirectiveValue(map, "nonce", true)); sb.append(":00000001:"); sb.append(ByteUtilities.asHex(hA2)); return ByteUtilities.asHex(hFinal);
/** * Handle a SOCKS4/SOCKS4a response from the proxy server. Test * the response buffer reply code and call {@link #setHandshakeComplete()} * if access is granted. * * @param buf the buffer holding the server response data. * @throws Exception if server response is malformed or if request is rejected * by the proxy server. */ protected void handleResponse(final IoBuffer buf) throws Exception { byte first = buf.get(0); if (first != 0) { throw new Exception("Socks response seems to be malformed"); } byte status = buf.get(1); // Consumes all the response data from the buffer buf.position(buf.position() + SocksProxyConstants.SOCKS_4_RESPONSE_SIZE); if (status == SocksProxyConstants.V4_REPLY_REQUEST_GRANTED) { setHandshakeComplete(); } else { throw new Exception("Proxy handshake failed - Code: 0x" + ByteUtilities.asHex(new byte[] { status }) + " (" + SocksProxyConstants.getReplyCodeAsString(status) + ")"); } } }
/** * Handle a SOCKS4/SOCKS4a response from the proxy server. Test * the response buffer reply code and call {@link #setHandshakeComplete()} * if access is granted. * * @param buf the buffer holding the server response data. * @throws Exception if server response is malformed or if request is rejected * by the proxy server. */ protected void handleResponse(final IoBuffer buf) throws Exception { byte first = buf.get(0); if (first != 0) { throw new Exception("Socks response seems to be malformed"); } byte status = buf.get(1); // Consumes all the response data from the buffer buf.position(buf.position() + SocksProxyConstants.SOCKS_4_RESPONSE_SIZE); if (status == SocksProxyConstants.V4_REPLY_REQUEST_GRANTED) { setHandshakeComplete(); } else { throw new Exception("Proxy handshake failed - Code: 0x" + ByteUtilities.asHex(new byte[] { status }) + " (" + SocksProxyConstants.getReplyCodeAsString(status) + ")"); } } }
/** * Handle a SOCKS4/SOCKS4a response from the proxy server. Test * the response buffer reply code and call {@link #setHandshakeComplete()} * if access is granted. * * @param buf the buffer holding the server response data. * @throws exception if server response is malformed or if request is rejected * by the proxy server. */ protected void handleResponse(final IoBuffer buf) throws Exception { byte first = buf.get(0); if (first != 0) { throw new Exception("Socks response seems to be malformed"); } byte status = buf.get(1); // Consumes all the response data from the buffer buf.position(buf.position() + SocksProxyConstants.SOCKS_4_RESPONSE_SIZE); if (status == SocksProxyConstants.V4_REPLY_REQUEST_GRANTED) { setHandshakeComplete(); } else { throw new Exception("Proxy handshake failed - Code: 0x" + ByteUtilities.asHex(new byte[] { status }) + " (" + SocksProxyConstants.getReplyCodeAsString(status) + ")"); } } }
throw new Exception("Proxy handshake failed - Code: 0x" + ByteUtilities.asHex(new byte[] { status }));
throw new Exception("Proxy handshake failed - Code: 0x" + ByteUtilities.asHex(new byte[] { status }));
+ ByteUtilities.asHex(new byte[] { status }));