/**
 * Copyright 2017 Google Inc. All rights reserved.
 * Modifications copyright (c) Microsoft Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import type http from 'http';
import type net from 'net';
import type stream from 'stream';
import { WebSocket } from 'ws';
type UpgradeActions = {
    doUpgrade: () => void;
    socket: stream.Duplex;
};
type IncomingMessageWithBody = http.IncomingMessage & {
    postBody: Promise<Buffer>;
};
export declare class TestServer {
    private _server;
    private _wsServer;
    private _dirPath;
    readonly debugServer: any;
    private _startTime;
    private _cachedPathPrefix;
    private _routes;
    private _auths;
    private _csp;
    private _extraHeaders;
    private _gzipRoutes;
    private _requestSubscribers;
    private _upgradeCallback;
    readonly PORT: number;
    readonly PREFIX: string;
    readonly CROSS_PROCESS_PREFIX: string;
    readonly EMPTY_PAGE: string;
    readonly HOST: string;
    readonly HOSTNAME: string;
    readonly HELLO_WORLD: string;
    static create(dirPath: string, port: number, loopback?: string): Promise<TestServer>;
    static certOptions(): Promise<{
        key: NonSharedBuffer;
        cert: NonSharedBuffer;
        passphrase: string;
    }>;
    static createHTTPS(dirPath: string, port: number, loopback?: string): Promise<TestServer>;
    constructor(dirPath: string, port: number, loopback?: string, sslOptions?: object);
    waitUntilReady(): Promise<void>;
    _onSocket(socket: net.Socket): void;
    enableHTTPCache(pathPrefix: string): void;
    setAuth(path: string, username: string, password: string): void;
    enableGzip(path: string): void;
    setCSP(path: string, csp: string): void;
    setExtraHeaders(path: string, object: Record<string, string>): void;
    stop(): Promise<void>;
    setContent(path: string, content: string, mimeType: string): void;
    setRoute(path: string, handler: (arg0: IncomingMessageWithBody, arg1: http.ServerResponse) => any): void;
    setRedirect(from: string, to: string): void;
    waitForRequest(path: string): Promise<IncomingMessageWithBody>;
    reset(): void;
    _onRequest(request: http.IncomingMessage, response: http.ServerResponse): void;
    serveFile(request: http.IncomingMessage, response: http.ServerResponse, filePath?: string): void;
    private _serveFile;
    onceWebSocketConnection(handler: (socket: WebSocket, request: http.IncomingMessage) => void): void;
    waitForWebSocketConnectionRequest(): Promise<http.IncomingMessage & {
        headers: http.IncomingHttpHeaders;
    }>;
    waitForUpgrade(): Promise<UpgradeActions>;
    waitForWebSocket(): Promise<WebSocket>;
    sendOnWebSocketConnection(data: any): void;
}
export {};
//# sourceMappingURL=index.d.ts.map