Java 类org.apache.http.impl.DefaultBHttpServerConnection 实例源码

项目:java-binrepo-proxy    文件:ElementalReverseProxy.java   
@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;
            }
        }
    }
项目:java-binrepo-proxy    文件:HttpCoreTransportServer.java   
@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;
            }
        }
    }
项目:purecloud-iot    文件:TestMalformedServerResponse.java   
@Override
public DefaultBHttpServerConnection createConnection(final Socket socket) throws IOException {
    final BrokenServerConnection conn = new BrokenServerConnection(4096);
    conn.bind(socket);
    return conn;
}
项目:Cherry    文件:WebEngine.java   
public HttpConnectionFactory<DefaultBHttpServerConnection> getHttpConnectionFactory() {
  if (null == _connectionFactory) _connectionFactory = DefaultBHttpServerConnectionFactory.INSTANCE;

  return _connectionFactory;
}
项目:Cherry    文件:WebEngineManager.java   
private HttpConnectionFactory<DefaultBHttpServerConnection> getHttpConnectionFactory() {
  return getWebEngine().getHttpConnectionFactory();
}
项目:fiware-cygnus    文件:CommonUtils.java   
/**
 * 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());

}