Code example for PushbackInputStream

Methods: readunread

0
	 * stream, when a SOCKS5 connection is being made, selects an authentication 
	 * NONE. 
	 */ 
	public ServerAuthenticator startSession(Socket s) throws IOException {
 
		final PushbackInputStream in = new PushbackInputStream(s
				.getInputStream());
		final OutputStream out = s.getOutputStream();
 
		final int version = in.read();
		if (version == 5) {
			if (!selectSocks5Authentication(in, out, 0)) {
				return null; 
			} 
		} else if (version == 4) {
			// Else it is the request message already, version 4 
			in.unread(version);
		} else { 
			return null; 
		} 
 
		return new ServerAuthenticatorNone(in, out);
	} 
 
	/** 
	 * Get input stream. 
	 *  
Stop searching for code, let great code find you!  Add Codota to your java IDE