Projects >> webbit >>5dd8e73fe435a74b3caa2dd1137d9fbe52262879

Chunk
Conflicting content
package org.webbitserver;

<<<<<<< HEAD
import org.webbitserver.netty.WebSocketClient;

import java.io.InputStream;
=======
import java.util.concurrent.Future;
>>>>>>> a794d75448eaa6e49f46e0b5061909e00989fb99

public interface WebSocket {
    Future start();
Solution content
package org.webbitserver;

import org.webbitserver.netty.WebSocketClient;

import java.io.InputStream;
import java.util.concurrent.Future;

public interface WebSocket {
    Future start();
File
WebSocket.java
Developer's decision
Concatenation
Kind of conflict
Import
Chunk
Conflicting content
    }

    @Override
<<<<<<< HEAD
    public WebSocketClient start() {
        final byte[] outboundMaskingKey = new byte[]{randomByte(), randomByte(), randomByte(), randomByte()};

        bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(
                Executors.newCachedThreadPool(),
                Executors.newCachedThreadPool()));

        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() throws Exception {
                ChannelPipeline pipeline = pipeline();
                if (ssl) {
                    if (sslFactory == null) {
                        throw new WebbitException("You need to call setupSsl first");
                    }
                    SSLContext sslContext = sslFactory.getClientContext();
                    SSLEngine sslEngine = sslContext.createSSLEngine();
                    sslEngine.setUseClientMode(true);
                    pipeline.addLast("ssl", new SslHandler(sslEngine));
                }
                pipeline.addLast("decoder", new HttpResponseDecoder());
                pipeline.addLast("encoder", new HttpRequestEncoder());
                pipeline.addLast("inflater", new HttpContentDecompressor());
                pipeline.addLast("handshakeHandler", new HandshakeChannelHandler(outboundMaskingKey));
                return pipeline;
            }
=======
    public Future start() {
        final FutureTask future = new FutureTask(new Callable() {
            @Override
            public WebSocket call() throws Exception {
                final byte[] outboundMaskingKey = new byte[]{randomByte(), randomByte(), randomByte(), randomByte()};

                bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(
                        Executors.newCachedThreadPool(),
                        Executors.newCachedThreadPool()));

                bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
                    public ChannelPipeline getPipeline() throws Exception {
                        ChannelPipeline pipeline = pipeline();
                        pipeline.addLast("decoder", new HttpResponseDecoder());
                        pipeline.addLast("encoder", new HttpRequestEncoder());
                        pipeline.addLast("inflater", new HttpContentDecompressor());
                        pipeline.addLast("handshakeHandler", new HandshakeChannelHandler(outboundMaskingKey));
                        return pipeline;
                    }
                });
                ChannelFuture future = bootstrap.connect(remoteAddress);
                channel = future.awaitUninterruptibly().getChannel();

                if (!future.isSuccess()) {
                    close();
                } else {
                    ChannelFuture requestFuture = channel.write(request);
                    requestFuture.awaitUninterruptibly();

                }

                return WebSocketClient.this;
            };
>>>>>>> a794d75448eaa6e49f46e0b5061909e00989fb99
        });

        executor.execute(future);
Solution content
    @Override
    }

    public Future start() {
        final FutureTask future = new FutureTask(new Callable() {
            @Override
            public WebSocket call() throws Exception {
                final byte[] outboundMaskingKey = new byte[]{randomByte(), randomByte(), randomByte(), randomByte()};

                bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(
                        Executors.newCachedThreadPool(),
                        Executors.newCachedThreadPool()));

                bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
                    public ChannelPipeline getPipeline() throws Exception {
                        ChannelPipeline pipeline = pipeline();
                        if (ssl) {
                            if (sslFactory == null) {
                                throw new WebbitException("You need to call setupSsl first");
                            }
                            SSLContext sslContext = sslFactory.getClientContext();
                            SSLEngine sslEngine = sslContext.createSSLEngine();
                            sslEngine.setUseClientMode(true);
                            pipeline.addLast("ssl", new SslHandler(sslEngine));
                        }
                        pipeline.addLast("decoder", new HttpResponseDecoder());
                        pipeline.addLast("encoder", new HttpRequestEncoder());
                        pipeline.addLast("inflater", new HttpContentDecompressor());
                        pipeline.addLast("handshakeHandler", new HandshakeChannelHandler(outboundMaskingKey));
                        return pipeline;
                    }
                });
                ChannelFuture future = bootstrap.connect(remoteAddress);
                channel = future.awaitUninterruptibly().getChannel();

                if (!future.isSuccess()) {
                    close();
                } else {
                    ChannelFuture requestFuture = channel.write(request);
                    requestFuture.awaitUninterruptibly();

                }

                return WebSocketClient.this;
            };
        });

        executor.execute(future);
File
WebSocketClient.java
Developer's decision
Combination
Kind of conflict
Attribute
Method invocation
Method signature
Variable