Java 类org.springframework.boot.devtools.tunnel.client.HttpTunnelConnection.TunnelChannel 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpTunnelConnectionTests.java   
@Test
public void typicalTraffic() throws Exception {
    this.requestFactory.willRespond("hi", "=2", "=3");
    TunnelChannel channel = openTunnel(true);
    write(channel, "hello");
    write(channel, "1+1");
    write(channel, "1+2");
    assertThat(this.incomingData.toString()).isEqualTo("hi=2=3");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpTunnelConnectionTests.java   
@Test
public void trafficWithLongPollTimeouts() throws Exception {
    for (int i = 0; i < 10; i++) {
        this.requestFactory.willRespond(HttpStatus.NO_CONTENT);
    }
    this.requestFactory.willRespond("hi");
    TunnelChannel channel = openTunnel(true);
    write(channel, "hello");
    assertThat(this.incomingData.toString()).isEqualTo("hi");
    assertThat(this.requestFactory.getExecutedRequests().size()).isGreaterThan(10);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpTunnelConnectionTests.java   
@Test
public void serviceUnavailableResponseLogsWarningAndClosesTunnel() throws Exception {
    this.requestFactory.willRespond(HttpStatus.SERVICE_UNAVAILABLE);
    TunnelChannel tunnel = openTunnel(true);
    assertThat(tunnel.isOpen()).isFalse();
    this.outputCapture.expect(containsString(
            "Did you forget to start it with remote debugging enabled?"));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpTunnelConnectionTests.java   
@Test
public void connectFailureLogsWarning() throws Exception {
    this.requestFactory.willRespond(new ConnectException());
    TunnelChannel tunnel = openTunnel(true);
    assertThat(tunnel.isOpen()).isFalse();
    this.outputCapture.expect(containsString(
            "Failed to connect to remote application at http://localhost:"
                    + this.port));
}
项目:spring-boot-concourse    文件:HttpTunnelConnectionTests.java   
@Test
public void typicalTraffic() throws Exception {
    this.requestFactory.willRespond("hi", "=2", "=3");
    TunnelChannel channel = openTunnel(true);
    write(channel, "hello");
    write(channel, "1+1");
    write(channel, "1+2");
    assertThat(this.incomingData.toString()).isEqualTo("hi=2=3");
}
项目:spring-boot-concourse    文件:HttpTunnelConnectionTests.java   
@Test
public void trafficWithLongPollTimeouts() throws Exception {
    for (int i = 0; i < 10; i++) {
        this.requestFactory.willRespond(HttpStatus.NO_CONTENT);
    }
    this.requestFactory.willRespond("hi");
    TunnelChannel channel = openTunnel(true);
    write(channel, "hello");
    assertThat(this.incomingData.toString()).isEqualTo("hi");
    assertThat(this.requestFactory.getExecutedRequests().size()).isGreaterThan(10);
}
项目:spring-boot-concourse    文件:HttpTunnelConnectionTests.java   
@Test
public void serviceUnavailableResponseLogsWarningAndClosesTunnel() throws Exception {
    this.requestFactory.willRespond(HttpStatus.SERVICE_UNAVAILABLE);
    TunnelChannel tunnel = openTunnel(true);
    assertThat(tunnel.isOpen()).isFalse();
    this.outputCapture.expect(containsString(
            "Did you forget to start it with remote debugging enabled?"));
}
项目:spring-boot-concourse    文件:HttpTunnelConnectionTests.java   
@Test
public void connectFailureLogsWarning() throws Exception {
    this.requestFactory.willRespond(new ConnectException());
    TunnelChannel tunnel = openTunnel(true);
    assertThat(tunnel.isOpen()).isFalse();
    this.outputCapture.expect(containsString(
            "Failed to connect to remote application at http://localhost:"
                    + this.port));
}
项目:contestparser    文件:HttpTunnelConnectionTests.java   
@Test
public void typicalTraffic() throws Exception {
    this.requestFactory.willRespond("hi", "=2", "=3");
    TunnelChannel channel = openTunnel(true);
    write(channel, "hello");
    write(channel, "1+1");
    write(channel, "1+2");
    assertThat(this.incommingData.toString(), equalTo("hi=2=3"));
}
项目:contestparser    文件:HttpTunnelConnectionTests.java   
@Test
public void trafficWithLongPollTimeouts() throws Exception {
    for (int i = 0; i < 10; i++) {
        this.requestFactory.willRespond(HttpStatus.NO_CONTENT);
    }
    this.requestFactory.willRespond("hi");
    TunnelChannel channel = openTunnel(true);
    write(channel, "hello");
    assertThat(this.incommingData.toString(), equalTo("hi"));
    assertThat(this.requestFactory.getExecutedRequests().size(), greaterThan(10));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpTunnelConnectionTests.java   
private void write(TunnelChannel channel, String string) throws IOException {
    channel.write(ByteBuffer.wrap(string.getBytes()));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpTunnelConnectionTests.java   
private TunnelChannel openTunnel(boolean singleThreaded) throws Exception {
    HttpTunnelConnection connection = new HttpTunnelConnection(this.url,
            this.requestFactory,
            (singleThreaded ? new CurrentThreadExecutor() : null));
    return connection.open(this.incomingChannel, this.closeable);
}
项目:spring-boot-concourse    文件:HttpTunnelConnectionTests.java   
private void write(TunnelChannel channel, String string) throws IOException {
    channel.write(ByteBuffer.wrap(string.getBytes()));
}
项目:spring-boot-concourse    文件:HttpTunnelConnectionTests.java   
private TunnelChannel openTunnel(boolean singleThreaded) throws Exception {
    HttpTunnelConnection connection = new HttpTunnelConnection(this.url,
            this.requestFactory,
            (singleThreaded ? new CurrentThreadExecutor() : null));
    return connection.open(this.incomingChannel, this.closeable);
}
项目:contestparser    文件:HttpTunnelConnectionTests.java   
private void write(TunnelChannel channel, String string) throws IOException {
    channel.write(ByteBuffer.wrap(string.getBytes()));
}
项目:contestparser    文件:HttpTunnelConnectionTests.java   
private TunnelChannel openTunnel(boolean singleThreaded) throws Exception {
    HttpTunnelConnection connection = new HttpTunnelConnection(this.url,
            this.requestFactory,
            (singleThreaded ? new CurrentThreadExecutor() : null));
    return connection.open(this.incomingChannel, this.closeable);
}