當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。