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


Java DefaultBHttpServerConnection类代码示例

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


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

示例1: run

import org.apache.http.impl.DefaultBHttpServerConnection; //导入依赖的package包/类
@Override
    public void run() {
        System.out.println("Listening on port " + this.serversocket.getLocalPort());
        while (!Thread.interrupted()) {
            try {
                final int bufsize = 8 * 1024;
                // Set up incoming HTTP connection
                final Socket insocket = this.serversocket.accept();
                final DefaultBHttpServerConnection inconn = new DefaultBHttpServerConnection(bufsize);
                System.out.println("Incoming connection from " + insocket.getInetAddress());
                inconn.bind(insocket);

                // Set up outgoing HTTP connection
                final Socket outsocket;
                if (this.target.getSchemeName().equals("https")) {
                    SSLContext sslcontext = SSLContexts.createSystemDefault();
                    SocketFactory sf = sslcontext.getSocketFactory();
                    outsocket = (SSLSocket) sf.createSocket(this.target.getHostName(), 443);
//                    // Enforce TLS and disable SSL
//                    socket.setEnabledProtocols(new String[] {
//                            "TLSv1",
//                            "TLSv1.1",
//                            "TLSv1.2" });
//                    // Enforce strong ciphers
//                    socket.setEnabledCipherSuites(new String[] {
//                            "TLS_RSA_WITH_AES_256_CBC_SHA",
//                            "TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
//                            "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" });
                } else {
                    outsocket = new Socket(this.target.getHostName(), this.target.getPort());
                }
                final DefaultBHttpClientConnection outconn = new DefaultBHttpClientConnection(bufsize);
                outconn.bind(outsocket);
                System.out.println("Outgoing connection to " + outsocket.getInetAddress());

                // Start worker thread
                final Thread t = new ProxyThread(this.httpService, inconn, outconn);
                t.setDaemon(true);
                t.start();
            } catch (final InterruptedIOException ex) {
                break;
            } catch (final IOException e) {
                System.err.println("I/O error initialising connection thread: "
                        + e.getMessage());
                break;
            }
        }
    }
 
开发者ID:netmackan,项目名称:java-binrepo-proxy,代码行数:49,代码来源:ElementalReverseProxy.java

示例2: run

import org.apache.http.impl.DefaultBHttpServerConnection; //导入依赖的package包/类
@Override
    public void run() {
        LOG.info("Listening on port {}", this.serversocket.getLocalPort());
        while (!Thread.interrupted()) {
            try {
                final int bufsize = 8 * 1024;
                // Set up incoming HTTP connection
                final Socket insocket = this.serversocket.accept();
                final DefaultBHttpServerConnection inconn = new DefaultBHttpServerConnection(bufsize);
                System.out.println("Incoming connection from " + insocket.getInetAddress());
                inconn.bind(insocket);

                // Set up outgoing HTTP connection
                final Socket outsocket;
                if (this.target.getSchemeName().equals("https")) {
                    SSLContext sslcontext = SSLContexts.createSystemDefault();
                    SocketFactory sf = sslcontext.getSocketFactory();
                    outsocket = (SSLSocket) sf.createSocket(this.target.getHostName(), 443);
//                    // Enforce TLS and disable SSL
//                    socket.setEnabledProtocols(new String[] {
//                            "TLSv1",
//                            "TLSv1.1",
//                            "TLSv1.2" });
//                    // Enforce strong ciphers
//                    socket.setEnabledCipherSuites(new String[] {
//                            "TLS_RSA_WITH_AES_256_CBC_SHA",
//                            "TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
//                            "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" });
                } else {
                    outsocket = new Socket(this.target.getHostName(), this.target.getPort());
                }
                final DefaultBHttpClientConnection outconn = new DefaultBHttpClientConnection(bufsize);
                outconn.bind(outsocket);
                LOG.info("Outgoing connection to {}", outsocket.getInetAddress());

                // Start worker thread
                final Thread t = new ElementalReverseProxy.ProxyThread(this.httpService, inconn, outconn);
                t.setDaemon(true);
                t.start();
            } catch (final InterruptedIOException ex) {
                break;
            } catch (final IOException e) {
                LOG.error("I/O error initialising connection thread: {}",
                        e.getMessage());
                break;
            }
        }
    }
 
开发者ID:netmackan,项目名称:java-binrepo-proxy,代码行数:49,代码来源:HttpCoreTransportServer.java

示例3: createConnection

import org.apache.http.impl.DefaultBHttpServerConnection; //导入依赖的package包/类
@Override
public DefaultBHttpServerConnection createConnection(final Socket socket) throws IOException {
    final BrokenServerConnection conn = new BrokenServerConnection(4096);
    conn.bind(socket);
    return conn;
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:7,代码来源:TestMalformedServerResponse.java

示例4: getHttpConnectionFactory

import org.apache.http.impl.DefaultBHttpServerConnection; //导入依赖的package包/类
public HttpConnectionFactory<DefaultBHttpServerConnection> getHttpConnectionFactory() {
  if (null == _connectionFactory) _connectionFactory = DefaultBHttpServerConnectionFactory.INSTANCE;

  return _connectionFactory;
}
 
开发者ID:Sabadios,项目名称:Cherry,代码行数:6,代码来源:WebEngine.java

示例5: getHttpConnectionFactory

import org.apache.http.impl.DefaultBHttpServerConnection; //导入依赖的package包/类
private HttpConnectionFactory<DefaultBHttpServerConnection> getHttpConnectionFactory() {
  return getWebEngine().getHttpConnectionFactory();
}
 
开发者ID:Sabadios,项目名称:Cherry,代码行数:4,代码来源:WebEngineManager.java

示例6: printLoadedJars

import org.apache.http.impl.DefaultBHttpServerConnection; //导入依赖的package包/类
/**
 * Only works in DEBUG level.
 * Prints the loaded .jar files at the start of Cygnus run.
 */
public static void printLoadedJars() {
    // trace the file containing the httpclient library
    URL myClassURL = PoolingClientConnectionManager.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading httpclient from " + myClassURL.toExternalForm());
    
    // trace the file containing the httpcore library
    myClassURL = DefaultBHttpServerConnection.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading httpcore from " + myClassURL.toExternalForm());
    
    // trace the file containing the junit library
    myClassURL = ErrorCollector.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading junit from " + myClassURL.toExternalForm());
    
    // trace the file containing the flume-ng-node library
    myClassURL =
            RegexExtractorInterceptorMillisSerializer.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading flume-ng-node from " + myClassURL.toExternalForm());
    
    // trace the file containing the libthrift library
    myClassURL = ListMetaData.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading libthrift from " + myClassURL.toExternalForm());
    
    // trace the file containing the gson library
    myClassURL = JsonPrimitive.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading gson from " + myClassURL.toExternalForm());
    
    // trace the file containing the json-simple library
    myClassURL = Yytoken.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading json-simple from " + myClassURL.toExternalForm());
    
    // trace the file containing the mysql-connector-java library
    myClassURL = Driver.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading mysql-connector-java from " + myClassURL.toExternalForm());
    
    // trace the file containing the postgresql library
    myClassURL = BlobOutputStream.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading postgresql from " + myClassURL.toExternalForm());
    
    // trace the file containing the log4j library
    myClassURL = SequenceNumberPatternConverter.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading log4j from " + myClassURL.toExternalForm());
    
    // trace the file containing the hadoop-core library
    myClassURL = AbstractMetricsContext.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading hadoop-core from " + myClassURL.toExternalForm());
    
    // trace the file containing the hive-exec library
    myClassURL = AbstractMapJoinOperator.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading hive-exec from " + myClassURL.toExternalForm());
    
    // trace the file containing the hive-jdbc library
    myClassURL = HivePreparedStatement.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading hive-jdbc from " + myClassURL.toExternalForm());
    
    // trace the file containing the mongodb-driver library
    myClassURL = AsyncReadWriteBinding.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading mongodb-driver from " + myClassURL.toExternalForm());
    
    // trace the file containing the kafka-clients library
    myClassURL = OffsetOutOfRangeException.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading kafka-clientsc from " + myClassURL.toExternalForm());
    
    // trace the file containing the zkclient library
    myClassURL = ZkNoNodeException.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading zkclient from " + myClassURL.toExternalForm());
    
    // trace the file containing the kafka_2.11 library
    myClassURL = KafkaMigrationTool.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading kafka_2.11 from " + myClassURL.toExternalForm());
    
    // trace the file containing the aws-java-sdk-dynamodb library
    myClassURL = WriteRequest.class.getProtectionDomain().getCodeSource().getLocation();
    LOGGER.debug("Loading aws-java-sdk-dynamodb from " + myClassURL.toExternalForm());

}
 
开发者ID:telefonicaid,项目名称:fiware-cygnus,代码行数:80,代码来源:CommonUtils.java


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