本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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;
}
示例4: getHttpConnectionFactory
import org.apache.http.impl.DefaultBHttpServerConnection; //导入依赖的package包/类
public HttpConnectionFactory<DefaultBHttpServerConnection> getHttpConnectionFactory() {
if (null == _connectionFactory) _connectionFactory = DefaultBHttpServerConnectionFactory.INSTANCE;
return _connectionFactory;
}
示例5: getHttpConnectionFactory
import org.apache.http.impl.DefaultBHttpServerConnection; //导入依赖的package包/类
private HttpConnectionFactory<DefaultBHttpServerConnection> getHttpConnectionFactory() {
return getWebEngine().getHttpConnectionFactory();
}
示例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());
}