All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fireflysource.net.tcp.aio.AioTcpConnection.kt Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package com.fireflysource.net.tcp.aio

import com.fireflysource.common.exception.UnsupportedOperationException
import com.fireflysource.common.sys.Result
import com.fireflysource.net.tcp.TcpConnection
import kotlinx.coroutines.CoroutineDispatcher
import java.nio.channels.AsynchronousSocketChannel
import java.util.function.Consumer

/**
 * @author Pengtao Qiu
 */
class AioTcpConnection(
    id: Int,
    maxIdleTime: Long,
    socketChannel: AsynchronousSocketChannel,
    dispatcher: CoroutineDispatcher,
    inputBufferSize: Int
) : AbstractAioTcpConnection(id, maxIdleTime, socketChannel, dispatcher, inputBufferSize) {

    override fun isSecureConnection(): Boolean = false

    override fun isClientMode(): Boolean {
        throw UnsupportedOperationException()
    }

    override fun isHandshakeComplete(): Boolean = true

    override fun getSupportedApplicationProtocols(): List = listOf()

    override fun beginHandshake(result: Consumer>): TcpConnection {
        result.accept(Result(true, "", null))
        return this
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy