Back to project page SimplePushDemoApp.
The source code is released under:
GNU General Public License
If you think the Android project SimplePushDemoApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.java_websocket.client; /* ww w . java 2s.c o m*/ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.channels.ByteChannel; import org.java_websocket.AbstractWrappedByteChannel; public abstract class AbstractClientProxyChannel extends AbstractWrappedByteChannel { protected final ByteBuffer proxyHandshake; /** * @param towrap * The channel to the proxy server **/ public AbstractClientProxyChannel( ByteChannel towrap ) { super( towrap ); try { proxyHandshake = ByteBuffer.wrap( buildHandShake().getBytes( "ASCII" ) ); } catch ( UnsupportedEncodingException e ) { throw new RuntimeException( e ); } } @Override public int write( ByteBuffer src ) throws IOException { if( !proxyHandshake.hasRemaining() ) { return super.write( src ); } else { return super.write( proxyHandshake ); } } public abstract String buildHandShake(); }