Search in sources :

Example 1 with HandshakeResponseDecoder

use of net.runelite.protocol.update.decoders.HandshakeResponseDecoder in project runelite by runelite.

the class CacheClient method connect.

public void connect() {
    Bootstrap b = new Bootstrap();
    b.group(group).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY, true).handler(new ChannelInitializer<SocketChannel>() {

        @Override
        public void initChannel(SocketChannel ch) throws Exception {
            ChannelPipeline p = ch.pipeline();
            // p.addFirst(new HttpProxyHandler(new InetSocketAddress("runelite.net", 3128)));
            p.addLast("decoder", new HandshakeResponseDecoder());
            p.addLast(new CacheClientHandler(), new HandshakeResponseHandler(CacheClient.this), new ArchiveResponseHandler(CacheClient.this));
            p.addLast(new UpdateHandshakeEncoder(), new EncryptionEncoder(), new ArchiveRequestEncoder());
        }
    });
    // Start the client.
    ChannelFuture f = b.connect(host, PORT).syncUninterruptibly();
    channel = f.channel();
}
Also used : ChannelFuture(io.netty.channel.ChannelFuture) NioSocketChannel(io.netty.channel.socket.nio.NioSocketChannel) SocketChannel(io.netty.channel.socket.SocketChannel) EncryptionEncoder(net.runelite.protocol.update.encoders.EncryptionEncoder) UpdateHandshakeEncoder(net.runelite.protocol.handshake.UpdateHandshakeEncoder) HandshakeResponseDecoder(net.runelite.protocol.update.decoders.HandshakeResponseDecoder) IOException(java.io.IOException) ChannelPipeline(io.netty.channel.ChannelPipeline) ArchiveRequestEncoder(net.runelite.protocol.update.encoders.ArchiveRequestEncoder) Bootstrap(io.netty.bootstrap.Bootstrap)

Aggregations

Bootstrap (io.netty.bootstrap.Bootstrap)1 ChannelFuture (io.netty.channel.ChannelFuture)1 ChannelPipeline (io.netty.channel.ChannelPipeline)1 SocketChannel (io.netty.channel.socket.SocketChannel)1 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)1 IOException (java.io.IOException)1 UpdateHandshakeEncoder (net.runelite.protocol.handshake.UpdateHandshakeEncoder)1 HandshakeResponseDecoder (net.runelite.protocol.update.decoders.HandshakeResponseDecoder)1 ArchiveRequestEncoder (net.runelite.protocol.update.encoders.ArchiveRequestEncoder)1 EncryptionEncoder (net.runelite.protocol.update.encoders.EncryptionEncoder)1