コード例 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void startServer(boolean httpEnabled, boolean httpsEnabled) throws Exception
        private void StartServer(bool httpEnabled, bool httpsEnabled)
        {
            CommunityServerBuilder serverBuilder = serverOnRandomPorts().usingDataDir(Folder.directory(Name.MethodName).AbsolutePath);

            if (!httpEnabled)
            {
                serverBuilder.WithHttpDisabled();
            }
            if (httpsEnabled)
            {
                serverBuilder.WithHttpsEnabled();
            }

            _server = serverBuilder.Build();
            _server.start();

            // Because we are generating a non-CA-signed certificate, we need to turn off verification in the client.
            // This is ironic, since there is no proper verification on the CA side in the first place, but I digress.
            TrustManager[] trustAllCerts = new TrustManager[] { new InsecureTrustManager() };

            // Install the all-trusting trust manager
            SSLContext sc = SSLContext.getInstance("TLS");

            sc.init(null, trustAllCerts, new SecureRandom());
            HttpsURLConnection.DefaultSSLSocketFactory = sc.SocketFactory;
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected org.neo4j.server.NeoServer getNeoServer(String customPageSwapperName) throws java.io.IOException
        protected internal override NeoServer GetNeoServer(string customPageSwapperName)
        {
            CommunityServerBuilder builder = EnterpriseServerBuilder.serverOnRandomPorts().withProperty(GraphDatabaseSettings.pagecache_swapper.name(), customPageSwapperName);

            return(builder.Build());
        }