• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UDPNetSyslogServerConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setUp

import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  serverStream = new ByteArrayOutputStream();
  PrintStream ps = new PrintStream(serverStream);

  final TCPNetSyslogServerConfig tcpNetSyslogServerConfig = new TCPNetSyslogServerConfig(45553);
  tcpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));

  final UDPNetSyslogServerConfig udpNetSyslogServerConfig = new UDPNetSyslogServerConfig(45553);
  udpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));

  final SSLTCPNetSyslogServerConfig ssltcpNetSyslogServerConfig = new SSLTCPNetSyslogServerConfig();
  ssltcpNetSyslogServerConfig.setPort(45554);
  ssltcpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));
  final String keyStore = this.getClass().getClassLoader().getResource("test-keystore.jks").getFile();
  ssltcpNetSyslogServerConfig.setKeyStore(keyStore);
  ssltcpNetSyslogServerConfig.setKeyStorePassword("password");
  ssltcpNetSyslogServerConfig.setTrustStore(keyStore);
  ssltcpNetSyslogServerConfig.setTrustStorePassword("password");

  SyslogServer.createThreadedInstance("testTcp", tcpNetSyslogServerConfig);
  SyslogServer.createThreadedInstance("testUdp", udpNetSyslogServerConfig);
  SyslogServer.createThreadedInstance("testTls", ssltcpNetSyslogServerConfig);
}
 
开发者ID:serioussam,项目名称:syslogappender,代码行数:25,代码来源:SyslogAppenderTest.java


示例2: setUp

import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
protected void setUp() {
    serverStream = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(serverStream);

    final TCPNetSyslogServerConfig tcpNetSyslogServerConfig = new TCPNetSyslogServerConfig(45553);
    tcpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));

    final UDPNetSyslogServerConfig udpNetSyslogServerConfig = new UDPNetSyslogServerConfig(45553);
    udpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));

    final SSLTCPNetSyslogServerConfig ssltcpNetSyslogServerConfig = new SSLTCPNetSyslogServerConfig();
    ssltcpNetSyslogServerConfig.setPort(45554);
    ssltcpNetSyslogServerConfig.addEventHandler(new PrintStreamSyslogServerEventHandler(ps));
    ssltcpNetSyslogServerConfig.setKeyStore(this.getClass().getClassLoader().getResource("test-keystore.jks").getFile());
    ssltcpNetSyslogServerConfig.setKeyStorePassword("password");
    ssltcpNetSyslogServerConfig.setTrustStore(this.getClass().getClassLoader().getResource("test-keystore.jks").getFile());
    ssltcpNetSyslogServerConfig.setTrustStorePassword("password");

    SyslogServer.createThreadedInstance("testTcp", tcpNetSyslogServerConfig);
    SyslogServer.createThreadedInstance("testUdp", udpNetSyslogServerConfig);
    SyslogServer.createThreadedInstance("testTls", ssltcpNetSyslogServerConfig);
}
 
开发者ID:papertrail,项目名称:logback-syslog4j,代码行数:23,代码来源:Syslog4jAppenderTest.java


示例3: startServer

import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
/**
 * Getting ready for tests.
 * @throws InterruptedException 
 */
@Before
public void startServer() throws InterruptedException {
    MockLogAppender.setupLogging();
    

    SyslogServerConfigIF serverConfig = new UDPNetSyslogServerConfig(SERVER_HOST, SERVER_PORT);
    serverConfig.setShutdownWait(0);
    m_logStream = new TestPrintStream(new StringOutputStream());
    SyslogServerEventHandlerIF eventHandler = new PrintStreamSyslogServerEventHandler(m_logStream);
    serverConfig.addEventHandler(eventHandler);
    m_server = SyslogServer.createThreadedInstance("test-udp", serverConfig);
    
    
    m_server.initialize("udp", serverConfig);
    
    //Need this sleep, found a deadlock in the server.
    Thread.sleep(100);
    m_server.run();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:24,代码来源:SyslogNorthBounderTest.java


示例4: testCreateAndDestroyServerByProtocol

import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
public void testCreateAndDestroyServerByProtocol() {
	UDPNetSyslogServerConfig config = new UDPNetSyslogServerConfig();
	config.setPort(999);
	
	SyslogServerIF server = SyslogServer.createInstance("udpToDestroy",config);
	
	SyslogServerIF matchServer = SyslogServer.getInstance("udpToDestroy");
	
	assertEquals(server,matchServer);
	
	SyslogServer.destroyInstance("");
	SyslogServer.destroyInstance("udpToDestroy");
	
	try {
		SyslogServer.getInstance("udpToDestroy");
		fail("udpToDestroy should not exist");
		
	} catch (SyslogRuntimeException sre) {
		//
	}
	
	assertFalse(SyslogServer.getSuppressRuntimeExceptions());
	SyslogServer.setSuppressRuntimeExceptions(true);
	assertTrue(SyslogServer.getSuppressRuntimeExceptions());

	assertNull(SyslogServer.getInstance("udpToDestroy"));

	SyslogServer.setSuppressRuntimeExceptions(false);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:30,代码来源:SyslogCreateAndDestroyTest.java


示例5: initialize

import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
public synchronized static void initialize() {
	createInstance(UDP,new UDPNetSyslogServerConfig());
	createInstance(TCP,new TCPNetSyslogServerConfig());
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:5,代码来源:SyslogServer.java


示例6: testUDPSession

import org.productivity.java.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig; //导入依赖的package包/类
public void testUDPSession() {
	SyslogServerConfigIF serverConfig = new UDPNetSyslogServerConfig(9999);
	
	UDPSessionHandler handler1 = new UDPSessionHandler("a");
	serverConfig.addEventHandler(handler1);
	
	UDPSessionHandler handler2 = new UDPSessionHandler("b");
	serverConfig.addEventHandler(handler2);
	
	SyslogServer.createThreadedInstance("udp_session",serverConfig);
	
	SyslogUtility.sleep(100);
	
	assertTrue(handler1.initialized);
	assertTrue(handler2.initialized);

	SyslogConfigIF config = new UDPNetSyslogConfig();
	config.setPort(9999);
	
	SyslogIF syslog1 = Syslog.createInstance("udp_session_1",config);
	
	syslog1.info("1");
	syslog1.info("2");

	SyslogIF syslog2 = Syslog.createInstance("udp_session_2",config);
	
	syslog2.info("3");
	syslog2.info("4");

	SyslogUtility.sleep(100);
	
	syslog1.shutdown();
	syslog2.shutdown();
	SyslogServer.destroyInstance("udp_session");
	
	try {
		SyslogServer.getInstance("udp_session");
		fail();
		
	} catch (SyslogRuntimeException sre) {
		//
	}
	
	assertTrue(handler1.okay);
	assertTrue(handler2.okay);
	
	SyslogUtility.sleep(250);
	
	assertTrue(handler1.destroyed);
	assertTrue(handler2.destroyed);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:52,代码来源:SyslogServerSessionTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Functions类代码示例发布时间:2022-05-22
下一篇:
Java JavaRunConfigurationModule类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap