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


Java SocketImplFactory类代码示例

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


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

示例1: setSocketImplFactory

import java.net.SocketImplFactory; //导入依赖的package包/类
public static synchronized void setSocketImplFactory(SocketImplFactory fac) throws IOException{

		/*
		 * Having a factory would be very tricky, as returned instances are not of type MockSocketImpl.
		 * Even if where to change "impl" into SocketImpl, then we wouldn't be able to call all its package
		 * level methods used in this class. We could use reflection though.
		 * Anyway, as this method is never used in SF110, we just throw a legal exception 
		 */
		throw new IOException("Setting of factory is not supported in virtual network");


		/*
		if (factory != null) {
			throw new SocketException("factory already defined");
		}
		SecurityManager security = System.getSecurityManager();
		if (security != null) {
			security.checkSetFactory();
		}
		factory = fac;
		 */
	}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:23,代码来源:MockSocket.java

示例2: testSetSocketImpl

import java.net.SocketImplFactory; //导入依赖的package包/类
private void testSetSocketImpl(HttpServletResponse response)
    throws IOException, AssertionFailedException {
  SocketImplFactory mockFactory =
      new SocketImplFactory() {
        @Override
        public SocketImpl createSocketImpl() {
          return null;
        }
      };

  SocketException caught = null;
  try {
    Socket.setSocketImplFactory(mockFactory);
  } catch (SocketException e) {
    caught = e;
  }
  assertNotNull("caught", caught, response);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:19,代码来源:TestSocketServlet.java

示例3: boot

import java.net.SocketImplFactory; //导入依赖的package包/类
/**
 * Set up socket factories to use JikesRVMSocketImpl
 */
public static void boot() {
  try {
    Socket.setSocketImplFactory(new SocketImplFactory() {
      public SocketImpl createSocketImpl() { return new JikesRVMSocketImpl(); }
    });
    ServerSocket.setSocketFactory(new SocketImplFactory() {
      public SocketImpl createSocketImpl() { return new JikesRVMSocketImpl(); }
    });
    DatagramSocket.setDatagramSocketImplFactory(new DatagramSocketImplFactory() {
      public DatagramSocketImpl createDatagramSocketImpl() {
        throw new VM_UnimplementedError("Need to implement JikesRVMDatagramSocketImpl");
      }
    });
  } catch (java.io.IOException e) {
    VM.sysFail("trouble setting socket impl factories");
  }
}
 
开发者ID:rmcilroy,项目名称:HeraJVM,代码行数:21,代码来源:JikesRVMSocketImpl.java

示例4: setSocketFactory

import java.net.SocketImplFactory; //导入依赖的package包/类
public static synchronized void setSocketFactory(SocketImplFactory fac) throws IOException {
	//for explanation, see MockSocket
	throw new IOException("Setting of factory is not supported in virtual network");
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:5,代码来源:MockServerSocket.java


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