private ObjectServerImpl(LocalObjectContainer container, ServerConfigurationImpl serverConfig, int port, bool isEmbeddedServer) { _isEmbeddedServer = isEmbeddedServer; _container = container; _serverConfig = serverConfig; _socketFactory = serverConfig.Networking.SocketFactory; _transactionPool = new ClientTransactionPool(container); _port = port; _name = "db4o ServerSocket FILE: " + container.ToString() + " PORT:" + _port; _container.SetServer(true); ConfigureObjectServer(); _classInfoHelper = new Db4objects.Db4o.CS.Internal.ClassInfoHelper(Db4oClientServerLegacyConfigurationBridge .AsLegacy(serverConfig)); _container.ClassCollection().CheckAllClassChanges(); bool ok = false; try { EnsureLoadStaticClass(); StartCommittedCallbackThread(_committedInfosQueue); StartServer(); if (_serverConfig != null) { _serverConfig.ApplyConfigurationItems(this); } ok = true; } finally { if (!ok) { Close(); } } }
public void Prepare(IConfiguration configuration) { INetworkingConfiguration networkConfig = Db4oClientServerLegacyConfigurationBridge.AsNetworkingConfiguration(configuration); ISocket4Factory currentSocketFactory = networkConfig.SocketFactory; networkConfig.SocketFactory = new MonitoredSocket4Factory(currentSocketFactory); }
public Socket4Adapter(ISocket4Factory socketFactory, string hostName, int port) { try { _delegate = socketFactory.CreateSocket(hostName, port); } catch (IOException e) { throw new Db4oIOException(e); } }
private static Thread StartClient(int port, ISocket4Factory factory) { var clientTread = new Thread(delegate() { var clientSocket = factory.CreateSocket("localhost", port); SendString(clientSocket, Message); }); clientTread.Name = "SslSocketTest thread"; clientTread.Start(); return(clientTread); }
private void AssertTimeoutBehavior(Thread serverTrigger, int serverTimeout, ISocket4Factory clientSocketFactory) { ISocket4Factory sslSocketFactory = new SslSocketFactory(new StandardSocket4Factory(), ServerCertificate()); var serverSocket = sslSocketFactory.CreateServerSocket(0); serverSocket.SetSoTimeout(serverTimeout); serverTrigger.IsBackground = true; serverTrigger.Start(serverSocket); var clientSocket = clientSocketFactory.CreateSocket("localhost", serverSocket.GetLocalPort()); if (!serverTrigger.Join(MinutesToMiliseconds(2))) { serverTrigger.Abort(); Assert.Fail("Server thread should have timedout."); } }
public PassThroughSocketFactory() { _delegating = new StandardSocket4Factory(); }
public PassThroughSocketFactory(ISocket4Factory delegating) { _delegating = delegating; }
public SslSocketFactory(ISocket4Factory delegating, X509Certificate2 certificate) { _certificate = certificate; _delegating = delegating; }
public CountingSocket4Factory(ISocket4Factory socketFactory) { _socketFactory = socketFactory; }
public MonitoredSocket4Factory(ISocket4Factory socketFactory) { _socketFactory = socketFactory; }
private static Thread StartClient(int port, ISocket4Factory factory) { Thread clientTread = new Thread(delegate() { ISocket4 clientSocket = factory.CreateSocket("localhost", port); SendString(clientSocket, Message); }); clientTread.Name = "SslSocketTest thread"; clientTread.Start(); return clientTread; }
private void AssertTimeoutBehavior(Thread serverTrigger, int serverTimeout, ISocket4Factory clientSocketFactory) { ISocket4Factory sslSocketFactory = new SslSocketFactory(new StandardSocket4Factory(), ServerCertificate()); IServerSocket4 serverSocket = sslSocketFactory.CreateServerSocket(0); serverSocket.SetSoTimeout(serverTimeout); serverTrigger.IsBackground = true; serverTrigger.Start(serverSocket); ISocket4 clientSocket = clientSocketFactory.CreateSocket("localhost", serverSocket.GetLocalPort()); if (!serverTrigger.Join(MinutesToMiliseconds(2))) { serverTrigger.Abort(); Assert.Fail("Server thread should have timedout."); } }
public SslSocketFactory(ISocket4Factory delegating, RemoteCertificateValidationCallback validationCallback) { _delegating = delegating; _validationCallback = validationCallback; }