当前位置: 首页>>代码示例>>Java>>正文


Java WebSocketClientHandshaker类代码示例

本文整理汇总了Java中io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker的典型用法代码示例。如果您正苦于以下问题:Java WebSocketClientHandshaker类的具体用法?Java WebSocketClientHandshaker怎么用?Java WebSocketClientHandshaker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WebSocketClientHandshaker类属于io.netty.handler.codec.http.websocketx包,在下文中一共展示了WebSocketClientHandshaker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initChannel

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
@Override
protected void initChannel(SocketChannel channel) throws SSLException {
    URI uri = config.getConnectionWebsocketUri();

    DefaultHttpHeaders headers = new DefaultHttpHeaders();
    headers.add(USER_ID_HEADER, config.getConnectionUserId().toString());
    headers.add(USER_PASSWORD_HEADER, config.getConnectionUserPassword());
    headers.add(SUPPLIER_ID_HEADER, config.getConnectionServerId());

    WebSocketClientHandshaker handshaker = WebSocketClientHandshakerFactory.newHandshaker(uri, WS_VERSION, null, false, headers);

    ChannelPipeline pipeline = channel.pipeline();
    if (config.isConnectionSecure()) {
        try {
            SslContext sslContext = SslContext.newClientContext(InsecureTrustManagerFactory.INSTANCE);
            pipeline.addLast(sslContext.newHandler(channel.alloc()));
        } catch (SSLException e) {
            logger.log(Level.SEVERE, "Shutting down client due to unexpected failure to create SSL context", e);
            throw e;
        }
    }
    pipeline.addLast(new HttpClientCodec());
    pipeline.addLast(new HttpObjectAggregator(8192));
    pipeline.addLast(new AudioConnectClientHandler(handshaker));
}
 
开发者ID:DeadmanDungeons,项目名称:AudioConnect,代码行数:26,代码来源:AudioConnectClient.java

示例2: setup

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    s = new Server(conf);
    s.run();

    Connector con = mac.getConnector("root", "secret");
    con.securityOperations().changeUserAuthorizations("root", new Authorizations("A", "B", "C", "D", "E", "F"));

    this.sessionId = UUID.randomUUID().toString();
    AuthCache.getCache().put(sessionId, token);
    group = new NioEventLoopGroup();
    SslContext ssl = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();

    String cookieVal = ClientCookieEncoder.STRICT.encode(Constants.COOKIE_NAME, sessionId);
    HttpHeaders headers = new DefaultHttpHeaders();
    headers.add(Names.COOKIE, cookieVal);

    WebSocketClientHandshaker handshaker = WebSocketClientHandshakerFactory.newHandshaker(LOCATION,
            WebSocketVersion.V13, (String) null, false, headers);
    handler = new ClientHandler(handshaker);
    Bootstrap boot = new Bootstrap();
    boot.group(group).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>() {

        @Override
        protected void initChannel(SocketChannel ch) throws Exception {
            ch.pipeline().addLast("ssl", ssl.newHandler(ch.alloc(), "127.0.0.1", WS_PORT));
            ch.pipeline().addLast(new HttpClientCodec());
            ch.pipeline().addLast(new HttpObjectAggregator(8192));
            ch.pipeline().addLast(handler);
        }
    });
    ch = boot.connect("127.0.0.1", WS_PORT).sync().channel();
    // Wait until handshake is complete
    while (!handshaker.isHandshakeComplete()) {
        sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
        LOG.debug("Waiting for Handshake to complete");
    }
}
 
开发者ID:NationalSecurityAgency,项目名称:qonduit,代码行数:39,代码来源:WebSocketIT.java

示例3: WebSocketTargetHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
public WebSocketTargetHandler(WebSocketClientHandshaker handshaker, boolean isSecure, String requestedUri,
                              String target, WebSocketConnectorListener webSocketConnectorListener) {
    this.handshaker = handshaker;
    this.isSecure = isSecure;
    this.requestedUri = requestedUri;
    this.target = target;
    this.connectorListener = webSocketConnectorListener;
    handshakeFuture = null;
}
 
开发者ID:wso2,项目名称:carbon-transports,代码行数:10,代码来源:WebSocketTargetHandler.java

示例4: addToPipeline

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
@Override
public void addToPipeline(final ChannelPipeline pipeline) {
    pipeline.addLast("http-codec", new HttpClientCodec());
    pipeline.addLast("aggregator", new HttpObjectAggregator(8192));

    final WebSocketClientHandshaker handShaker = new WhiteSpaceInPathWebSocketClientHandshaker13(serverUri,
            WebSocketVersion.V13, PROTOCOL, false, createHttpHeaders(httpHeaders), Integer.MAX_VALUE);
    pipeline.addLast("websocket-protocol-handler", new WebSocketClientProtocolHandler(handShaker));

    pipeline.addLast("websocket-frame-codec", new ByteBufToWebSocketFrameCodec());
}
 
开发者ID:saxsys,项目名称:SynchronizeFX,代码行数:12,代码来源:WebsocketChannelInitializer.java

示例5: WebSocketClientHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
public WebSocketClientHandler(long uid, WebSocketClientHandshaker handshaker) {
    this.uid = uid;
    this.handshaker = handshaker;
}
 
开发者ID:ninelook,项目名称:wecard-server,代码行数:5,代码来源:WebSocketClientHandler.java

示例6: ClientHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
public ClientHandler(WebSocketClientHandshaker handshaker) {
    this.handshaker = handshaker;
}
 
开发者ID:NationalSecurityAgency,项目名称:qonduit,代码行数:4,代码来源:WebSocketIT.java

示例7: AudioConnectClientHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
private AudioConnectClientHandler(WebSocketClientHandshaker handshaker) {
    this.handshaker = handshaker;
}
 
开发者ID:DeadmanDungeons,项目名称:AudioConnect,代码行数:4,代码来源:AudioConnectClient.java

示例8: MeetupWebSocketClientHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
MeetupWebSocketClientHandler(WebSocketClientHandshaker handshaker, RSVPProducer rsvpProducer) {
    this.handshaker = handshaker;
    this.rsvpProducer = rsvpProducer;
}
 
开发者ID:apsaltis,项目名称:StreamingData-Book-Examples,代码行数:5,代码来源:MeetupWebSocketClientHandler.java

示例9: WebSocketClientHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
public WebSocketClientHandler(final WebSocketClientHandshaker handshaker) {
    this.handshaker = handshaker;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:4,代码来源:WebSocketClientHandler.java

示例10: WebSocketClientHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
public WebSocketClientHandler(WebSocketClientHandshaker handshaker, CountDownLatch latch) {
    this.handshaker = handshaker;
    this.latch = latch;
    this.isOpen = true;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:6,代码来源:WebSocketClientHandler.java

示例11: onOpen

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
@Override
public void onOpen(WebSocketClientHandshaker handShaker) {
	// TODO Auto-generated method stub
	
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:6,代码来源:NettyTestClient.java

示例12: onOpen

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
@Override
public void onOpen(WebSocketClientHandshaker handShaker) {
	logger.log(Level.INFO, "onOpen");
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:5,代码来源:AbstractClient.java

示例13: WebSocketClientHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
public WebSocketClientHandler(WebSocketClientHandshaker handshaker) {
	this.handshaker = handshaker;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:4,代码来源:WebSocketClientHandler.java

示例14: WebSocketClientHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
public WebSocketClientHandler(WebSocketClientHandshaker handshaker) {
    this.handshaker = handshaker;
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:4,代码来源:WebSocketClientHandler.java

示例15: MessageReceiverWebSocketClientHandler

import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; //导入依赖的package包/类
public MessageReceiverWebSocketClientHandler(WebSocketClientHandshaker handshaker) {
	this.handshaker = handshaker;
}
 
开发者ID:iotracks,项目名称:iofabric,代码行数:4,代码来源:MessageReceiverWebSocketClientHandler.java


注:本文中的io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。